mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-20 12:00:53 +08:00
Add QunitAssert parameter to setup functions
Add QunitAssert parameter to the setup, teardown, beforeEach and afterEach functions. This facilitates the usage of for example async code in the setup.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Vendored
+8
-4
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user