@japa/runner 2.2.3 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +1 -1
- package/build/src/core/main.d.ts +14 -0
- package/build/src/core/main.js +18 -0
- package/package.json +2 -2
package/build/index.js
CHANGED
|
@@ -175,7 +175,7 @@ async function endTests(runner) {
|
|
|
175
175
|
function showHelp() {
|
|
176
176
|
const green = cliui_1.logger.colors.green.bind(cliui_1.logger.colors);
|
|
177
177
|
const grey = cliui_1.logger.colors.grey.bind(cliui_1.logger.colors);
|
|
178
|
-
console.log(`@japa/runner v2.
|
|
178
|
+
console.log(`@japa/runner v2.3.0
|
|
179
179
|
|
|
180
180
|
Options:
|
|
181
181
|
${green('--tests')} ${grey('Specify test titles')}
|
package/build/src/core/main.d.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { DataSetNode, Test as BaseTest, Group as BaseGroup, Suite as BaseSuite, Runner as BaseRunner, TestHooksCleanupHandler, TestContext as BaseTestContext } from '@japa/core';
|
|
2
2
|
export declare class TestContext extends BaseTestContext {
|
|
3
3
|
test: Test;
|
|
4
|
+
/**
|
|
5
|
+
* Methods to call after the test context instance
|
|
6
|
+
* is created
|
|
7
|
+
*/
|
|
8
|
+
static createdCallbacks: ((context: TestContext) => void)[];
|
|
9
|
+
/**
|
|
10
|
+
* Register a function to get notified when an instance of test
|
|
11
|
+
* context is created. The callback must be synchronous
|
|
12
|
+
*/
|
|
13
|
+
static created(callback: (context: TestContext) => void): typeof TestContext;
|
|
14
|
+
/**
|
|
15
|
+
* Register a cleanup function. Cleanup functions are called after
|
|
16
|
+
* the test finishes
|
|
17
|
+
*/
|
|
4
18
|
cleanup: (handler: TestHooksCleanupHandler<this>) => void;
|
|
5
19
|
constructor(test: Test);
|
|
6
20
|
}
|
package/build/src/core/main.js
CHANGED
|
@@ -11,15 +11,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
11
11
|
exports.Runner = exports.Suite = exports.Group = exports.Test = exports.TestContext = void 0;
|
|
12
12
|
const core_1 = require("@japa/core");
|
|
13
13
|
class TestContext extends core_1.TestContext {
|
|
14
|
+
/**
|
|
15
|
+
* Register a function to get notified when an instance of test
|
|
16
|
+
* context is created. The callback must be synchronous
|
|
17
|
+
*/
|
|
18
|
+
static created(callback) {
|
|
19
|
+
this.createdCallbacks.push(callback);
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
14
22
|
constructor(test) {
|
|
15
23
|
super();
|
|
16
24
|
this.test = test;
|
|
17
25
|
this.cleanup = (handler) => {
|
|
18
26
|
test.cleanup(handler);
|
|
19
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Invoke ready callbacks
|
|
30
|
+
*/
|
|
31
|
+
const Constructor = this.constructor;
|
|
32
|
+
Constructor.createdCallbacks.forEach((callback) => callback(this));
|
|
20
33
|
}
|
|
21
34
|
}
|
|
22
35
|
exports.TestContext = TestContext;
|
|
36
|
+
/**
|
|
37
|
+
* Methods to call after the test context instance
|
|
38
|
+
* is created
|
|
39
|
+
*/
|
|
40
|
+
TestContext.createdCallbacks = [];
|
|
23
41
|
class Test extends core_1.Test {
|
|
24
42
|
}
|
|
25
43
|
exports.Test = Test;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@japa/runner",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Runner for Japa testing framework",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"japa": "^4.0.0",
|
|
50
50
|
"mrm": "^4.1.13",
|
|
51
51
|
"np": "^7.6.3",
|
|
52
|
-
"prettier": "^2.8.
|
|
52
|
+
"prettier": "^2.8.4",
|
|
53
53
|
"typescript": "^4.9.5"
|
|
54
54
|
},
|
|
55
55
|
"mrmConfig": {
|