Search code examples
ember-cliqunit

Cannot get Ember test to fail


I'm very green to Ember testing, but have found a lot of useful documentation for it online so far (thank you people!). One of the issues I'm hitting here, though, is I cannot get a test to fail. Strange, I know. For example, I have the following:

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");
});

However, if I run the ember-cli command: ember test It says everything passes..

$ 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

What am I doing wrong here???


Solution

  • When in doubt look to the docs, tests need to end with a -test.js in order to run.