我有一个第一次正确运行的繁重任务(运行手写笔,转换咖啡,运行测试)。但是当watch
任务开始时,它会运行mochaTest:all
任务但没有运行测试。
配置:
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
├─┬ grunt@0.4.1
├── grunt-contrib-coffee@0.7.0
├── grunt-contrib-stylus@0.5.0
├─┬ grunt-contrib-watch@0.5.1
├─┬ grunt-mocha-test@0.6.3
├── grunt-text-replace@0.3.2
编辑:根据 Gilad 的建议,没有区别:
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)
...