gotwarlost / istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k stars 787 forks source link

Istanbul does not support QUnit #867

Open MhdTlb opened 6 years ago

MhdTlb commented 6 years ago

I'm trying to use istanbul to get code coverage from QUnit tests. I have included all my js tests files in HTML file. My project has the same stucture as this example.

When I run istanbul cover test\index.html I got this error:

No coverage information was collected, exit without writing coverage information
C:\Projects\...\Test\index.html:1
(function (exports, require, module, __filename, __dirname) { <!DOCTYPE html>
                                                              ^
SyntaxError: Unexpected token <
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Object.Module._extensions.(anonymous function) [as .js] (C:\...\node_modules\istanbul\lib\hook.js:109:37)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Function.Module.runMain (module.js:604:10)
    at runFn (C:\...\node_modules\istanbul\lib\command\common\run-with-cover.js:122:16)

How to setup istanbul with QUnit?