【发布时间】:2012-12-29 14:39:10
【问题描述】:
运行 yeoman server:test 在我的浏览器中打开 Jasmine 并说我的测试已通过。现在我想尝试同样的方法,但没有浏览器 - 在 CLI 上使用 PhantomJS。不幸的是,运行yeoman test 只会抛出:
Running "jasmine:all" (jasmine) task
Running specs for index.html
>> 0 assertions passed in 0 specs (0ms)
即使所有内容都包含在我的test/index.html 中并且使用yeoman server:test 运行良好,为什么它没有找到任何测试?
我在我的项目中使用了yeoman init jasmine:app --force,并按照here 的描述调整了Gruntfile.js。看起来是这样的:
...
// headless testing through PhantomJS
jasmine: {
all: ["test/**/*.html"]
},
...
// Alias the `test` task to run the `jasmine` task instead
grunt.registerTask("test", "jasmine");
...
注意:我的测试是用 CoffeeScript 编写的。
【问题讨论】: