Merge pull request #6956 from Malyngo/master

Qunit: Add QunitAssert parameter to setup functions
This commit is contained in:
Masahiro Wakame
2015-12-01 22:48:19 +09:00
2 changed files with 32 additions and 4 deletions
+24
View File
@@ -170,6 +170,30 @@ QUnit.module("module A", {
}
});
QUnit.module("module with async setup and teardown", {
setup: function (assert) {
var done = assert.async();
setTimeout(function () {
// prepare something for all following tests
});
},
teardown: function (assert) {
// clean up after each test
}
});
QUnit.module("module with async setup and teardown", {
beforeEach: function (assert: QUnitAssert) {
var done = assert.async();
setTimeout(function () {
// prepare something for all following tests
});
},
afterEach: function () {
// clean up after each test
}
});
QUnit.test("a test", function (assert) {
function square(x) {
+8 -4
View File
@@ -148,23 +148,27 @@ interface URLConfigItem {
interface LifecycleObject {
/**
* Runs before each test
* @param assert
* @deprecated
*/
setup?: () => void;
setup?: (assert: QUnitAssert) => void;
/**
* Runs after each test
* @param assert
* @deprecated
*/
teardown?: () => void;
teardown?: (assert: QUnitAssert) => void;
/**
* Runs before each test
* @param assert
*/
beforeEach?: () => void;
beforeEach?: (assert: QUnitAssert) => void;
/**
* Runs after each test
* @param assert
*/
afterEach?: () => void;
afterEach?: (assert: QUnitAssert) => void;
/**
* Any additional properties on the hooks object will be added to that context.