@japa/runner 4.2.0 → 4.3.1
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/{chunk-CYGUHLQ7.js → chunk-PCBL2VZP.js} +2 -2
- package/build/{chunk-DPWXK7IV.js → chunk-U3BSXCEH.js} +5 -5
- package/build/{chunk-WEAHCEFK.js → chunk-Y57JXJ7G.js} +4 -4
- package/build/factories/main.js +5 -5
- package/build/index.d.ts +5 -1
- package/build/index.js +15 -13
- package/build/modules/core/main.js +1 -1
- package/build/src/reporters/main.js +2 -2
- package/package.json +18 -21
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
Runner as BaseRunner,
|
|
9
9
|
TestContext as BaseTestContext
|
|
10
10
|
} from "@japa/core";
|
|
11
|
-
import { inspect } from "
|
|
12
|
-
import { AssertionError } from "
|
|
11
|
+
import { inspect } from "util";
|
|
12
|
+
import { AssertionError } from "assert";
|
|
13
13
|
|
|
14
14
|
// modules/core/reporters/base.ts
|
|
15
15
|
import ms from "ms";
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
BaseReporter,
|
|
3
3
|
colors,
|
|
4
4
|
icons
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-PCBL2VZP.js";
|
|
6
6
|
|
|
7
7
|
// src/reporters/dot.ts
|
|
8
8
|
var DotReporter = class extends BaseReporter {
|
|
@@ -35,7 +35,7 @@ var DotReporter = class extends BaseReporter {
|
|
|
35
35
|
|
|
36
36
|
// src/reporters/spec.ts
|
|
37
37
|
import ms from "ms";
|
|
38
|
-
import { relative } from "
|
|
38
|
+
import { relative } from "path";
|
|
39
39
|
var SpecReporter = class extends BaseReporter {
|
|
40
40
|
/**
|
|
41
41
|
* Tracking if the first event we get is for a test without any parent group
|
|
@@ -155,7 +155,7 @@ ${colors.dim(this.#getRelativeFilename(this.currentFileName))}`);
|
|
|
155
155
|
};
|
|
156
156
|
|
|
157
157
|
// src/reporters/ndjson.ts
|
|
158
|
-
import { relative as relative2 } from "
|
|
158
|
+
import { relative as relative2 } from "path";
|
|
159
159
|
import { serializeError } from "serialize-error";
|
|
160
160
|
var NdJSONReporter = class extends BaseReporter {
|
|
161
161
|
/**
|
|
@@ -241,8 +241,8 @@ var NdJSONReporter = class extends BaseReporter {
|
|
|
241
241
|
|
|
242
242
|
// src/reporters/github.ts
|
|
243
243
|
import slash from "slash";
|
|
244
|
-
import { relative as relative3 } from "
|
|
245
|
-
import { stripVTControlCharacters } from "
|
|
244
|
+
import { relative as relative3 } from "path";
|
|
245
|
+
import { stripVTControlCharacters } from "util";
|
|
246
246
|
import { ErrorsPrinter } from "@japa/errors-printer";
|
|
247
247
|
var GithubReporter = class extends BaseReporter {
|
|
248
248
|
/**
|
|
@@ -3,17 +3,17 @@ import {
|
|
|
3
3
|
github,
|
|
4
4
|
ndjson,
|
|
5
5
|
spec
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-U3BSXCEH.js";
|
|
7
7
|
import {
|
|
8
8
|
Group,
|
|
9
9
|
Refiner,
|
|
10
10
|
Test,
|
|
11
11
|
TestContext,
|
|
12
12
|
colors
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-PCBL2VZP.js";
|
|
14
14
|
|
|
15
15
|
// src/debug.ts
|
|
16
|
-
import { debuglog } from "
|
|
16
|
+
import { debuglog } from "util";
|
|
17
17
|
var debug_default = debuglog("japa:runner");
|
|
18
18
|
|
|
19
19
|
// src/validator.ts
|
|
@@ -91,7 +91,7 @@ var validator_default = new Validator();
|
|
|
91
91
|
// src/files_manager.ts
|
|
92
92
|
import slash from "slash";
|
|
93
93
|
import fastGlob from "fast-glob";
|
|
94
|
-
import { pathToFileURL } from "
|
|
94
|
+
import { pathToFileURL } from "url";
|
|
95
95
|
var FILE_SUFFIX_EXPRESSION = /(\.spec|\.test)?\.[js|ts|jsx|tsx|mjs|mts|cjs|cts]+$/;
|
|
96
96
|
var FilesManager = class {
|
|
97
97
|
/**
|
package/build/factories/main.js
CHANGED
|
@@ -5,17 +5,17 @@ import {
|
|
|
5
5
|
Planner,
|
|
6
6
|
createTest,
|
|
7
7
|
createTestGroup
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-Y57JXJ7G.js";
|
|
9
|
+
import "../chunk-U3BSXCEH.js";
|
|
10
10
|
import {
|
|
11
11
|
Emitter,
|
|
12
12
|
Runner,
|
|
13
13
|
Suite
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-PCBL2VZP.js";
|
|
15
15
|
import "../chunk-2KG3PWR4.js";
|
|
16
16
|
|
|
17
17
|
// factories/runner.ts
|
|
18
|
-
import { fileURLToPath } from "
|
|
18
|
+
import { fileURLToPath } from "url";
|
|
19
19
|
var RunnerFactory = class {
|
|
20
20
|
#emitter = new Emitter();
|
|
21
21
|
#config;
|
|
@@ -100,7 +100,7 @@ var RunnerFactory = class {
|
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
// factories/create_dummy_tests.ts
|
|
103
|
-
import assert from "
|
|
103
|
+
import assert from "assert";
|
|
104
104
|
function createUnitTestsSuite(emitter, refiner, file) {
|
|
105
105
|
const suite = new Suite("unit", emitter, refiner);
|
|
106
106
|
const group = createTestGroup("Maths#add", emitter, refiner, {
|
package/build/index.d.ts
CHANGED
|
@@ -8,13 +8,17 @@ type OmitFirstArg<F> = F extends [_: any, ...args: infer R] ? R : never;
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function test(title: string, callback?: TestExecutor<TestContext, undefined>): Test<undefined>;
|
|
10
10
|
export declare namespace test {
|
|
11
|
-
var group: (title: string, callback: (group: Group) => void) =>
|
|
11
|
+
var group: (title: string, callback: (group: Group) => void) => Group;
|
|
12
12
|
var macro: <T extends (test: Test, ...args: any[]) => any>(callback: T) => (...args: OmitFirstArg<Parameters<T>>) => ReturnType<T>;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Get the test of currently running test
|
|
16
16
|
*/
|
|
17
17
|
export declare function getActiveTest(): Test<any> | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Get the test of currently running test or throw an error
|
|
20
|
+
*/
|
|
21
|
+
export declare function getActiveTestOrFail(): Test<any>;
|
|
18
22
|
/**
|
|
19
23
|
* Make Japa process command line arguments. Later the parsed output
|
|
20
24
|
* will be used by Japa to compute the configuration
|
package/build/index.js
CHANGED
|
@@ -7,24 +7,24 @@ import {
|
|
|
7
7
|
createTestGroup,
|
|
8
8
|
debug_default,
|
|
9
9
|
validator_default
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-Y57JXJ7G.js";
|
|
11
|
+
import "./chunk-U3BSXCEH.js";
|
|
12
12
|
import {
|
|
13
13
|
Emitter,
|
|
14
14
|
Runner,
|
|
15
15
|
Suite,
|
|
16
16
|
colors
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-PCBL2VZP.js";
|
|
18
18
|
import "./chunk-2KG3PWR4.js";
|
|
19
19
|
|
|
20
20
|
// index.ts
|
|
21
|
-
import { fileURLToPath } from "
|
|
21
|
+
import { fileURLToPath } from "url";
|
|
22
22
|
import { ErrorsPrinter as ErrorsPrinter2 } from "@japa/errors-printer";
|
|
23
23
|
|
|
24
24
|
// src/plugins/retry.ts
|
|
25
|
-
import { join } from "
|
|
26
|
-
import findCacheDirectory from "find-cache-
|
|
27
|
-
import { mkdir, readFile, unlink, writeFile } from "
|
|
25
|
+
import { join } from "path";
|
|
26
|
+
import findCacheDirectory from "find-cache-directory";
|
|
27
|
+
import { mkdir, readFile, unlink, writeFile } from "fs/promises";
|
|
28
28
|
var CACHE_DIR = findCacheDirectory({ name: "@japa/runner" });
|
|
29
29
|
var SUMMARY_FILE = CACHE_DIR ? join(CACHE_DIR, "summary.json") : void 0;
|
|
30
30
|
async function getFailedTests() {
|
|
@@ -158,17 +158,14 @@ function test(title, callback) {
|
|
|
158
158
|
}
|
|
159
159
|
test.group = function(title, callback) {
|
|
160
160
|
validator_default.ensureIsInPlanningPhase(executionPlanState.phase);
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
emitter,
|
|
164
|
-
runnerConfig.refiner,
|
|
165
|
-
executionPlanState
|
|
166
|
-
);
|
|
161
|
+
const group = createTestGroup(title, emitter, runnerConfig.refiner, executionPlanState);
|
|
162
|
+
executionPlanState.group = group;
|
|
167
163
|
if (cliArgs.bail && cliArgs.bailLayer === "group") {
|
|
168
164
|
executionPlanState.group.bail(true);
|
|
169
165
|
}
|
|
170
166
|
callback(executionPlanState.group);
|
|
171
167
|
executionPlanState.group = void 0;
|
|
168
|
+
return group;
|
|
172
169
|
};
|
|
173
170
|
test.macro = function(callback) {
|
|
174
171
|
return (...args) => {
|
|
@@ -181,6 +178,10 @@ test.macro = function(callback) {
|
|
|
181
178
|
function getActiveTest() {
|
|
182
179
|
return activeTest;
|
|
183
180
|
}
|
|
181
|
+
function getActiveTestOrFail() {
|
|
182
|
+
if (!activeTest) throw new Error("Cannot access active test outside of a test callback");
|
|
183
|
+
return activeTest;
|
|
184
|
+
}
|
|
184
185
|
function processCLIArgs(argv) {
|
|
185
186
|
cliArgs = new CliParser().parse(argv);
|
|
186
187
|
}
|
|
@@ -276,6 +277,7 @@ async function run() {
|
|
|
276
277
|
export {
|
|
277
278
|
configure,
|
|
278
279
|
getActiveTest,
|
|
280
|
+
getActiveTestOrFail,
|
|
279
281
|
processCLIArgs,
|
|
280
282
|
run,
|
|
281
283
|
test
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@japa/runner",
|
|
3
3
|
"description": "A simple yet powerful testing framework for Node.js",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.3.1",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.16.0"
|
|
7
7
|
},
|
|
@@ -35,36 +35,33 @@
|
|
|
35
35
|
"quick:test": "glob -c \"node --import=ts-node-maintained/register/esm --enable-source-maps --test-reporter=spec --test\" \"tests/*.spec.ts\""
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@adonisjs/eslint-config": "^2.
|
|
39
|
-
"@adonisjs/prettier-config": "^1.4.
|
|
40
|
-
"@adonisjs/tsconfig": "^1.4.
|
|
41
|
-
"@release-it/conventional-changelog": "^10.0.
|
|
42
|
-
"@swc/core": "1.
|
|
43
|
-
"@types/chai": "^5.
|
|
44
|
-
"@types/chai-subset": "^1.3.5",
|
|
45
|
-
"@types/find-cache-dir": "^5.0.2",
|
|
38
|
+
"@adonisjs/eslint-config": "^2.1.0",
|
|
39
|
+
"@adonisjs/prettier-config": "^1.4.5",
|
|
40
|
+
"@adonisjs/tsconfig": "^1.4.1",
|
|
41
|
+
"@release-it/conventional-changelog": "^10.0.1",
|
|
42
|
+
"@swc/core": "1.13.1",
|
|
43
|
+
"@types/chai": "^5.2.2",
|
|
46
44
|
"@types/ms": "^2.1.0",
|
|
47
|
-
"@types/node": "^
|
|
45
|
+
"@types/node": "^24.0.15",
|
|
48
46
|
"c8": "^10.1.3",
|
|
49
|
-
"chai": "^5.1
|
|
50
|
-
"chai-subset": "^1.6.0",
|
|
47
|
+
"chai": "^5.2.1",
|
|
51
48
|
"cross-env": "^7.0.3",
|
|
52
49
|
"del-cli": "^6.0.0",
|
|
53
|
-
"eslint": "^9.
|
|
54
|
-
"glob": "^11.0.
|
|
55
|
-
"prettier": "^3.
|
|
56
|
-
"release-it": "^
|
|
50
|
+
"eslint": "^9.31.0",
|
|
51
|
+
"glob": "^11.0.3",
|
|
52
|
+
"prettier": "^3.6.2",
|
|
53
|
+
"release-it": "^19.0.4",
|
|
57
54
|
"ts-node-maintained": "^10.9.5",
|
|
58
|
-
"tsup": "^8.
|
|
59
|
-
"typescript": "^5.
|
|
55
|
+
"tsup": "^8.5.0",
|
|
56
|
+
"typescript": "^5.8.3"
|
|
60
57
|
},
|
|
61
58
|
"dependencies": {
|
|
62
59
|
"@japa/core": "^10.3.0",
|
|
63
60
|
"@japa/errors-printer": "^4.1.2",
|
|
64
|
-
"@poppinss/colors": "^4.1.
|
|
65
|
-
"@poppinss/hooks": "^7.2.
|
|
61
|
+
"@poppinss/colors": "^4.1.5",
|
|
62
|
+
"@poppinss/hooks": "^7.2.6",
|
|
66
63
|
"fast-glob": "^3.3.3",
|
|
67
|
-
"find-cache-
|
|
64
|
+
"find-cache-directory": "^6.0.0",
|
|
68
65
|
"getopts": "^2.3.0",
|
|
69
66
|
"ms": "^2.1.3",
|
|
70
67
|
"serialize-error": "^12.0.0",
|