cod*_*het 4 mocha.js node.js npm istanbul
module.js这个错误谈论的地方是什么?刚刚在这里找到它
load函数认为该命令是一个'.js'文件.如何为'.cmd'文件添加扩展处理程序????
使用yo和创建项目后generator-gulpplugin-coffee,我立即遇到了一个问题npm test
基本package.json "test"参数中列出的完整命令是
coffeelint gulpfile.coffee index.coffee test -f ./coffeelint.json && istanbul test _mocha --report lcovonly -- ./test/*.coffee --require coffee-script/register --reporter spec
Run Code Online (Sandbox Code Playgroud)
当我提取该命令并运行它时,coffeelint工作正常,但是在文件中的符号处istanbul test _mocha...出现Unexpected token ILLEGAL错误时失败:'@'_mocha.cmd
$ npm test
> gulp-ember-template-compiler-2@0.0.0 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)
Run Code Online (Sandbox Code Playgroud)
我试过更新库没有成功,这是我的package.json:
{
"name": "dadeda",
"version": "0.0.0",
"description": "A plugin for gulp",
"keywords": [
"gulpplugin"
],
"repository": "me/dadeda",
"author": {
"name": "me",
"email": "me@there.com",
"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"
}
Run Code Online (Sandbox Code Playgroud)
我使用windows 10,node 0.12.7,npm 2.11.3.
这是Windows机器上的一个问题,因为它无法_mocha像javascript那样执行文件 - 正如您已经确定的那样.
解决方法是传递mocha文件的完整路径(如本期所述):
istanbul test node_modules/mocha/bin/_mocha
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1394 次 |
| 最近记录: |