我安装了nodejs和jasmine-node,它在命令行中运行。
WebStorm Runner的配置:
jasmine-node --config endpoint ServerAddress:8083
G:\NPWorkDir\frisby
src\protocol\find_spec.js
"C:\Program Files\JetBrains\WebStorm\bin\runnerw.exe" "G:\Program
Files\nodejs\node.exe" jasmine-node --config endpoint ServerAddress:8083
G:\NPWorkDir\frisby\src\
protocol\find_spec.js
module.js:471
throw err;
^
Error: Cannot find module 'G:\NPWorkDir\tester-frisbys\jasmine-node'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
Process finished with exit code 1
完整配置以运行jsmine-node:
我的答案使用linux而不是windows路径名!
我会推荐jasmine而不是jasmine-node,它似乎更实际。使用创建配置
./node_modules/.bin/jasmine init
如有必要,请编辑jasmine.json
。
我会在package.json
中创建一个npm脚本:
"scripts": {
"test": "node_modules/.bin/jasmine",
...
},
并在Webstorm中将其定义为npm脚本;命令:run,script:test