Closed flftfqwxf closed 10 years ago
OS for window
@flftfqwxf Your file names are mixed up. The demo/demo.js
file is listed as a src
js file, but it's actually the test file. If you change the src
file in your Gruntfile.js
to demo/test.js
, coverage will work as expected. Alternatively--and more logically--just switch the filenames of demo.js
and test.js
.
@jgerigmeyer Thank you! but I met a new problem .
I will not have a problem when not use web server,but when use web server and qunit-istanbul , my reports were empty .
I don't know What's wrong?
https://github.com/flftfqwxf/qunit-istanbul.git my config: qunit: { options: { '--web-security': 'no', coverage: { disposeCollector: true, src: ['scaffold/test/demo/demo.js'], instrumentedFiles: 'test-temp/', htmlReport: 'report/coverage', coberturaReport: 'report/', linesThresholdPct: 10, baseUrl:'.' }, urls: [ 'http://localhost:8000/scaffold/test/demo/index.html' ] }, all: ['<%=pkg.test_dir%>/demo/index.html'] }, connect: { server: { options: { port: 8000, base: '.' } } }
src or baseUrl,is wrong??
@flftfqwxf You're correct. This was due to a bug in grunt-qunit-istanbul when serving files via a webserver in Windows. I fixed it and published version 0.4.3, so please upgrade to the latest version and try again. Thanks!
very good! @jgerigmeyer .I solved the BUG, but still use yours :)
@jgerigmeyer,I found that there is a other bugs , when I both use web server and local,only generate d web server report.
qunit.js: I add this code to lines 214 : if (options.coverage && options.coverage.instrumentedFiles) { instrumentedFiles[fileStorage.replace(/^\/?/g, "/").replace(/\/g, "/")] = instrumenter.instrumentSync(String(fs.readFileSync(filepath)), filepath); }
becasue, in this conditions "if (options.urls && options.coverage && options.coverage.baseUrl) {" local files not in instrumentedFiles
@flftfqwxf Thanks for catching that! Fixed in v0.4.4.
Hi I use grunt-qunit-istanbul,but it always at 100%?
my git: https://github.com/flftfqwxf/qunit-istanbul.git
Please forgive me that I don't speak English well.