You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.
If I run npm test, everything works fine. If I run npm run coverage, I get:
> [email protected] coverage /tmp/foo
> istanbul cover _mocha
No coverage information was collected, exit without writing coverage information
/tmp/foo/test/sum.js:4
let result = 4;
^^^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:387:25)
at Object.Module._extensions..js (module.js:422:10)
at Object.Module._extensions.(anonymous function) [as .js] (/tmp/foo/node_modules/istanbul/lib/hook.js:109:37)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at /tmp/foo/node_modules/mocha/lib/mocha.js:219:27
at Array.forEach (native)
at Mocha.loadFiles (/tmp/foo/node_modules/mocha/lib/mocha.js:216:14)
at Mocha.run (/tmp/foo/node_modules/mocha/lib/mocha.js:468:10)
at Object.<anonymous> (/tmp/foo/node_modules/mocha/bin/_mocha:403:18)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Object.Module._extensions.(anonymous function) [as .js] (/tmp/foo/node_modules/istanbul/lib/hook.js:109:37)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
at runFn (/tmp/foo/node_modules/istanbul/lib/command/common/run-with-cover.js:122:16)
at /tmp/foo/node_modules/istanbul/lib/command/common/run-with-cover.js:251:17
at /tmp/foo/node_modules/istanbul/lib/util/file-matcher.js:68:16
at /tmp/foo/node_modules/async/lib/async.js:52:16
at /tmp/foo/node_modules/async/lib/async.js:361:13
at /tmp/foo/node_modules/async/lib/async.js:52:16
at async.forEachOf.async.eachOf (/tmp/foo/node_modules/async/lib/async.js:236:30)
at _asyncMap (/tmp/foo/node_modules/async/lib/async.js:355:9)
at Object.map (/tmp/foo/node_modules/async/lib/async.js:337:20)
at /tmp/foo/node_modules/istanbul/lib/util/file-matcher.js:44:15
at Object.next (/tmp/foo/node_modules/fileset/lib/fileset.js:43:14)
at emitOne (events.js:90:13)
at Fileset.emit (events.js:182:7)
at Fileset.Glob._finish (/tmp/foo/node_modules/glob/glob.js:172:8)
at done (/tmp/foo/node_modules/glob/glob.js:159:12)
at Fileset.Glob._processGlobStar2 (/tmp/foo/node_modules/glob/glob.js:601:12)
at /tmp/foo/node_modules/glob/glob.js:590:10
at RES (/tmp/foo/node_modules/inflight/inflight.js:23:14)
at f (/tmp/foo/node_modules/once/once.js:17:25)
at lstatcb_ (/tmp/foo/node_modules/glob/glob.js:491:7)
at RES (/tmp/foo/node_modules/inflight/inflight.js:23:14)
at f (/tmp/foo/node_modules/once/once.js:17:25)
at FSReqWrap.oncomplete (fs.js:82:15)
Yup, that's the correct fix. And not, it's not a bug. The way mocha works is that it accepts all sorts of options and then launches a subprocess with those options enabled for the node executable.
I have the following structure:
mocha.opts
just has--use_strict
.sum.js
has:In my
package.json
, I've added:If I run
npm test
, everything works fine. If I runnpm run coverage
, I get:I'm running
[email protected]
and[email protected]
with NodeJS 5.5.0.If I change my
coverage
script to runnode --use_strict ./node_modules/.bin/istanbul cover _mocha
, everything runs fine.This seems related to #44.
The text was updated successfully, but these errors were encountered: