I use QUnit for JavaScript unit testing, have quite a few tests already. Majority of them uses assert in the way:
ok(condition.isTrue());
These tests are run well by Visual Studio embeded tests system (in the "Test Explorer") and by 'external' QUnit engine (which is called by clicking 'QUnit test (click to run)' context menu that is displayed if you hit circle left to the QUnit test).
But if I use assert in another way:
notOk(condition.isFalse());
Then tests are run well only inside of Visual Studio tests system, while attempt to run tests by QUnit give following error:
Died on test #1 at http://localhost:64720/Tests.js:123:1: notOk is not defined
Source:
ReferenceError: notOk is not defined
at Object.<anonymous> (http://localhost:64720/Tests.js:129:5)
at Object.Test.run (http://localhost:64720/qunit.js:790:18)
at http://localhost:64720/qunit.js:877:10
at process (http://localhost:64720/qunit.js:593:24)
at http://localhost:64720/qunit.js:182:5
Why does this happen and how to make "notOk" running properly by QUnit?
Thank you.
Are you facing the same problem as here: 'equal' is not defined : Ember-qunit does not seem to be importing ?
The solution is to use notOk through assert like this:
test('it is not ok', function(assert) {
var some_value = false;
assert.notOk(some_value);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With