module.js
this error talks about is?just found it here
load
function thinks the command was a '.js'
file. How can i add extension handlers for '.cmd'
files????
After creating a project using yo
and generator-gulpplugin-coffee
, I have run into an issue straight away with the command npm test
The full command listed in the base package.json "test"
paramater is
coffeelint gulpfile.coffee index.coffee test -f ./coffeelint.json && istanbul test _mocha --report lcovonly -- ./test/*.coffee --require coffee-script/register --reporter spec
The coffeelint works fine when i extract that command and run it, however the istanbul test _mocha...
fails with an Unexpected token ILLEGAL
error at the '@'
symbol in the _mocha.cmd
file:
$ npm test
> [email protected] test C:\Users\me\code\something
> coffeelint gulpfile.coffee index.coffee test -f ./coffeelint.json && istanbul test _mocha --report lcovonly -- ./test/*.coffee --require coffee-script/register --reporter spec
✓ gulpfile.coffee
✓ index.coffee
✓ test/main.coffee
✓ Ok! » 0 errors and 0 warnings in 3 files
C:\Users\me\code\something\node_modules\.bin\_mocha.CMD:1
(function (exports, require, module, __filename, __dirname) { @IF EXIST "%~dp0
^
SyntaxError: Unexpected token ILLEGAL
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at runFn (C:\Users\me\code\something\node_modules\istanbul\lib\command\common\run-with-cover.js:122:16)
at Object.run (C:\Users\me\code\something\node_modules\istanbul\lib\command\common\run-with-cover.js:254:9)
at TestCommand.Command.mix.run (C:\Users\me\code\something\node_modules\istanbul\lib\command\test.js:27:22)
at runCommand (C:\Users\me\code\something\node_modules\istanbul\lib\cli.js:78:19)
I've tried updating the libraries without success, here is my package.json:
{
"name": "dadeda",
"version": "0.0.0",
"description": "A plugin for gulp",
"keywords": [
"gulpplugin"
],
"repository": "me/dadeda",
"author": {
"name": "me",
"email": "[email protected]",
"url": "http://methere.com"
},
"files": [
"index.js"
],
"scripts": {
"prepublish": "gulp coffee --require coffee-script/register",
"test": "coffeelint gulpfile.coffee index.coffee test -f ./coffeelint.json && istanbul test _mocha --report lcovonly -- ./test/*.coffee --require coffee-script/register --reporter spec",
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
},
"dependencies": {
"gulp-util": "^3.0.0",
"through2": "^0.6.1"
},
"devDependencies": {
"coffee-script": "^1.7.1",
"coffeelint": "^1.4.0",
"coveralls": "^2.8.0",
"del": "^1.2.1",
"gulp": "^3.5.2",
"gulp-coffee": "^2.1.2",
"istanbul": "^0.3.19",
"mocha": "^2.2.5",
"should": "^7.1.0"
},
"engines": {
"node": ">=0.10.0",
"npm": ">=1.3.7"
},
"license": "MIT"
}
I am using windows 10
, node 0.12.7
, npm 2.11.3
.
This is an issue on Windows machines as it can't execute the _mocha
file as javascript - as you have identified.
The workaround is to pass the full path of the mocha file (as described in this issue):
istanbul test node_modules/mocha/bin/_mocha
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With