【问题标题】:CLI testing with Jasmine / PhantomJS使用 Jasmine / PhantomJS 进行 CLI 测试
【发布时间】: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 编写的。

【问题讨论】:

    标签: jasmine phantomjs yeoman


    【解决方案1】:

    经过一些研究,我发现 PhantomJS 无法在与 'yeoman server' 或 yeoman server:test 相同的位置找到文件。

    我在另一个帖子中提出了我的问题:Running tests in both headless and browser

    【讨论】:

      猜你喜欢
      • 2015-12-03
      • 1970-01-01
      • 2016-02-26
      • 1970-01-01
      • 2013-05-01
      • 1970-01-01
      • 2015-07-31
      • 2013-06-28
      • 1970-01-01
      相关资源
      最近更新 更多