无法让Ember测试失败

时间:2015-04-11 15:24:41

标签: ember-cli qunit

我对Ember测试非常环保,但到目前为止已在网上找到了很多有用的文档(谢谢大家!)。但是,我在这里遇到的一个问题是我无法通过测试来失败。奇怪,我知道。例如,我有以下内容:

import {
  module,
  test
} from 'qunit';

module("Example tests");

test("This is an example test", function(assert) {
  assert.equal(1, 1, "Ember knows 1 is equal to 1");
});

test("This is another example test", function(assert) {
  assert.notEqual(1, 2, "Ember knows 1 is not equal to 2");
});

test("This is a 3rd example test", function(assert) {
  assert.equal(1, 2, "Luke, you're an idiot");
});

但是,如果我运行ember-cli命令:ember test 它说一切都过去了..

$ ember test
Future versions of Ember CLI will not support v0.10.38. Please update to Node 0.12 or io.js.
version: 0.2.2

A new version of ember-cli is available (0.2.3). To install it, type ember update.
Could not find watchman, falling back to NodeWatcher for file system events.
Visit http://www.ember-cli.com/#watchman for more info.
Built project successfully. Stored in "/Users/luke/Examples/iris/tmp/class-tests_dist-DYvAvX3c.tmp".
ok 1 PhantomJS 1.9 - JSHint - .: app.js should pass jshint
ok 2 PhantomJS 1.9 - JSHint - helpers: helpers/resolver.js should pass jshint
ok 3 PhantomJS 1.9 - JSHint - helpers: helpers/start-app.js should pass jshint
ok 4 PhantomJS 1.9 - JSHint - .: router.js should pass jshint
ok 5 PhantomJS 1.9 - JSHint - .: test-helper.js should pass jshint
ok 6 PhantomJS 1.9 - JSHint - unit: unit/ExampleTest.js should pass jshint

1..6
# tests 6
# pass  6
# fail  0

# ok

我在这里做错了什么???

1 个答案:

答案 0 :(得分:1)

如有疑问请查看docs,测试需要以-test.js结束才能运行。