grunt手表启动测试,但没有测试运行
问题描述:
我有一个第一次运行正常(运行手写笔,运输咖啡,运行测试)的咕噜任务。但是当watch
任务启动时,它将运行mochaTest:all
任务,但不会运行测试。grunt手表启动测试,但没有测试运行
配置:
grunt.initConfig
watch:
coffee:
files: ['app/assets/src/coffee/**/*.coffee', 'app/assets/src/coffee/*.coffee', 'app/webserver.coffee']
tasks: ['coffee:dev', 'replace', 'mochaTest:all']
options:
nospawn: true
test:
files: ['test/calc/*.coffee', 'test/*.coffee']
tasks: ['test']
options:
nospawn: true
stylus:
files: 'app/assets/src/styl/**/*.styl'
tasks: 'stylus:dev'
mochaTest:
all:
src: [ 'test/calc/*.coffee', 'test/*.coffee']
options:
reporter: 'nyan'
timeout: 1000
...
grunt.registerTask "test", [ "mochaTest"]
直接运行测试:
$ grunt 'mochaTest'
Running "mochaTest:all" (mochaTest) task
...
264 passing (10 seconds)
好,所以这是工作。但是当手表被触发时,没有测试运行:
Waiting...
OK
>> File "test/dataLayer-test.coffee" changed.
Running "mochaTest:all" (mochaTest) task
0 passing (1 ms)
没有测试运行。我必须有一些配置错误的东西。这里有什么问题?这是一个错误吗?
版本:
$ npm list | grep grunt
├─┬ [email protected]
├── [email protected]
├── [email protected]
├─┬ [email protected]
├─┬ [email protected]
├── [email protected]
编辑:每吉拉德的建议,没有什么区别,但:
grunt watch --verbose --debug
...
Running "mochaTest:all" (mochaTest) task
[D] Task source: /home/dev/projects/alpha/node_modules/grunt-mocha-test/tasks/mocha.js
Verifying property mochaTest.all exists in config...OK
Files: test/calc/calc-test.coffee, ...
264 passing (9 seconds)
5 pending
>> File "test/ui-formulaEditor-test.coffee" changed.
Running "mochaTest:all" (mochaTest) task
[D] Task source: /home/dev/projects/alpha/node_modules/grunt-mocha-test/tasks/mocha.js
Verifying property mochaTest.all exists in config...OK
Files: test/calc/calc-test.coffee, ...
0 passing (2 ms)
...
运行'grunt watch --verbose --debug'。在我看来,从手表运行的mochaTest没有获得正确的参数。另外 - nospawn是一个古老的参数。使用产卵。 –
@GiladPeleg无变化,更新问题 – jcollum
spawn:false或nospawn:true表示手表将在同一上下文中运行任务。我推荐默认值,特别是用测试套件产生你的任务。 –