Comparing version 0.5.6 to 0.5.7
@@ -1,2 +0,2 @@ | ||
var QUnit = require('../support/qunit/qunit'), | ||
var QUnit = require('../support/qunit/qunit/qunit.js'), | ||
path = require('path'), | ||
@@ -3,0 +3,0 @@ _ = require('underscore'), |
{ | ||
"name": "qunit", | ||
"description": "QUnit testing framework for nodejs", | ||
"version": "0.5.6", | ||
"version": "0.5.7", | ||
"author": "Oleg Slobodskoi <oleg008@gmail.com>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -25,4 +25,2 @@ ## QUnit testing framework for nodejs. | ||
http://docs.jquery.com/QUnit | ||
#### Setup | ||
@@ -43,24 +41,24 @@ // Add a test to run. | ||
// A boolean assertion, equivalent to JUnit's assertTrue. Passes if the first argument is truthy. | ||
ok(state, message) | ||
assert.ok(state, message) | ||
// A comparison assertion, equivalent to JUnit's assertEquals. Uses "==". | ||
equal(actual, expected, message) | ||
assert.equal(actual, expected, message) | ||
// A comparison assertion, equivalent to JUnit's assertEquals. Uses "==". | ||
notEqual(actual, expected, message) | ||
// A comparison assertion, equivalent to JUnit's assertEquals. Uses "!=". | ||
assert.notEqual(actual, expected, message) | ||
// A deep recursive comparison assertion, working on primitive types, arrays and objects. | ||
deepEqual(actual, expected, message) | ||
assert.deepEqual(actual, expected, message) | ||
// A deep recursive comparison assertion, working on primitive types, arrays and objects, with the result inverted, passing // when some property isn't equal. | ||
notDeepEqual(actual, expected, message) | ||
assert.notDeepEqual(actual, expected, message) | ||
// A comparison assertion. Uses "===". | ||
strictEqual(actual, expected, message) | ||
assert.strictEqual(actual, expected, message) | ||
// A stricter comparison assertion then notEqual. Uses "===". | ||
notStrictEqual(actual, expected, message) | ||
// A stricter comparison assertion then notEqual. Uses "!==". | ||
assert.notStrictEqual(actual, expected, message) | ||
// Assertion to test if a callback throws an exception when run. | ||
raises(actual, message) | ||
assert.throws(actual, message) | ||
@@ -211,16 +209,9 @@ #### Asynchronous Testing | ||
Because nodejs modules reserved "module" namespace we have to redefine it from QUnit namespace. | ||
Some tests examples | ||
module = QUnit.module; | ||
Basically QUnit API can ba accessed directly from global object or optional via "QUnit" object. | ||
QUnit.test; | ||
Some tests examples | ||
test("a basic test example", function() { | ||
ok(true, "this test is fine"); | ||
var value = "hello"; | ||
equals("hello", value, "We expect value to be hello"); | ||
test("a basic test example", function (assert) { | ||
assert.ok(true, "this test is fine"); | ||
var value = "hello"; | ||
assert.equal("hello", value, "We expect value to be hello"); | ||
}); | ||
@@ -230,15 +221,16 @@ | ||
test("first test within module", 1, function() { | ||
ok(true, "all pass"); | ||
test("first test within module", 1, function (assert) { | ||
assert.ok(true, "a dummy"); | ||
}); | ||
test("second test within module", 2, function() { | ||
ok(true, "all pass"); | ||
test("second test within module", 2, function (assert) { | ||
assert.ok(true, "dummy 1 of 2"); | ||
assert.ok(true, "dummy 2 of 2"); | ||
}); | ||
module("Module B", { | ||
setup: function() { | ||
setup: function () { | ||
// do some initial stuff before every test for this module | ||
}, | ||
teardown: function() { | ||
teardown: function () { | ||
// do some stuff after every test for this module | ||
@@ -248,6 +240,6 @@ } | ||
test("some other test", function() { | ||
expect(2); | ||
equals(true, false, "failing test"); | ||
equals(true, true, "passing test"); | ||
test("some other test", function (assert) { | ||
expect(2); | ||
assert.equal(true, false, "failing test"); | ||
assert.equal(true, true, "passing test"); | ||
}); | ||
@@ -258,16 +250,16 @@ | ||
// setup a shared environment for each test | ||
this.options = {test: 123}; | ||
this.options = { test: 123 }; | ||
} | ||
}); | ||
test("this test is using shared environment", 1, function() { | ||
same({test:123}, this.options, "passing test"); | ||
test("this test is using shared environment", 1, function (assert) { | ||
assert.deepEqual({ test: 123 }, this.options, "passing test"); | ||
}); | ||
test("this is an async test example", function() { | ||
test("this is an async test example", function (assert) { | ||
expect(2); | ||
stop(); | ||
setTimeout(function() { | ||
ok(true, "finished async test"); | ||
strictEqual(true, true, "Strict equal assertion uses ==="); | ||
setTimeout(function () { | ||
assert.ok(true, "finished async test"); | ||
assert.strictEqual(true, true, "Strict equal assertion uses ==="); | ||
start(); | ||
@@ -277,2 +269,3 @@ }, 100); | ||
### Run tests | ||
@@ -279,0 +272,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
235714
64
5804
273
3