@japa/runner 4.4.1 → 4.5.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/README.md +0 -61
- package/build/chunk-2KG3PWR4.js +17 -0
- package/build/chunk-L7YZLDZD.js +340 -0
- package/build/chunk-RFKFNXTE.js +347 -0
- package/build/chunk-WNJXMFYL.js +520 -0
- package/build/factories/create_dummy_tests.d.ts +1 -1
- package/build/factories/main.d.ts +1 -1
- package/build/factories/main.js +232 -182
- package/build/factories/runner.d.ts +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.js +278 -214
- package/build/modules/core/main.js +21 -2
- package/build/modules/core/reporters/base.d.ts +1 -1
- package/build/src/create_test.d.ts +1 -1
- package/build/src/debug.d.ts +1 -1
- package/build/src/helpers.d.ts +2 -2
- package/build/src/hooks.d.ts +1 -1
- package/build/src/plugins/main.js +28 -20
- package/build/src/reporters/main.js +14 -3
- package/build/src/reporters/spec.d.ts +1 -1
- package/build/src/types.js +14 -7
- package/build/src/validator.d.ts +1 -1
- package/package.json +32 -29
- package/build/create_test-CuTGNCAf.js +0 -353
- package/build/helpers-BlHaYYTh.js +0 -241
- package/build/main-CB1nhl6c.js +0 -336
package/build/index.js
CHANGED
|
@@ -1,238 +1,302 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import {
|
|
2
|
+
CliParser,
|
|
3
|
+
ConfigManager,
|
|
4
|
+
GlobalHooks,
|
|
5
|
+
Planner,
|
|
6
|
+
createTest,
|
|
7
|
+
createTestGroup,
|
|
8
|
+
debug_default,
|
|
9
|
+
validator_default
|
|
10
|
+
} from "./chunk-WNJXMFYL.js";
|
|
11
|
+
import "./chunk-RFKFNXTE.js";
|
|
12
|
+
import {
|
|
13
|
+
Emitter,
|
|
14
|
+
Runner,
|
|
15
|
+
Suite,
|
|
16
|
+
colors,
|
|
17
|
+
printPinnedTests
|
|
18
|
+
} from "./chunk-L7YZLDZD.js";
|
|
19
|
+
import "./chunk-2KG3PWR4.js";
|
|
20
|
+
|
|
21
|
+
// index.ts
|
|
22
|
+
import { fileURLToPath } from "url";
|
|
23
|
+
import { ErrorsPrinter as ErrorsPrinter2 } from "@japa/errors-printer";
|
|
24
|
+
|
|
25
|
+
// src/plugins/retry.ts
|
|
26
|
+
import { join } from "path";
|
|
8
27
|
import findCacheDirectory from "find-cache-directory";
|
|
9
|
-
|
|
10
|
-
|
|
28
|
+
import { mkdir, readFile, unlink, writeFile } from "fs/promises";
|
|
29
|
+
var CACHE_DIR = findCacheDirectory({ name: "@japa/runner" });
|
|
30
|
+
var SUMMARY_FILE = CACHE_DIR ? join(CACHE_DIR, "summary.json") : void 0;
|
|
11
31
|
async function getFailedTests() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
32
|
+
try {
|
|
33
|
+
const summary = await readFile(SUMMARY_FILE, "utf-8");
|
|
34
|
+
return JSON.parse(summary);
|
|
35
|
+
} catch (error) {
|
|
36
|
+
if (error.code === "ENOENT") {
|
|
37
|
+
return {};
|
|
38
|
+
}
|
|
39
|
+
throw new Error("Unable to read failed tests cache file", { cause: error });
|
|
40
|
+
}
|
|
19
41
|
}
|
|
20
42
|
async function cacheFailedTests(tests) {
|
|
21
|
-
|
|
22
|
-
|
|
43
|
+
await mkdir(CACHE_DIR, { recursive: true });
|
|
44
|
+
await writeFile(SUMMARY_FILE, JSON.stringify({ tests }));
|
|
23
45
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
var retryPlugin = async function retry({ config, cliArgs: cliArgs2 }) {
|
|
47
|
+
if (!SUMMARY_FILE) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
config.teardown.push(async (runner) => {
|
|
51
|
+
const summary = runner.getSummary();
|
|
52
|
+
await cacheFailedTests(summary.failedTestsTitles);
|
|
53
|
+
});
|
|
54
|
+
if (cliArgs2.failed) {
|
|
55
|
+
try {
|
|
56
|
+
const { tests } = await getFailedTests();
|
|
57
|
+
if (!tests || !tests.length) {
|
|
58
|
+
console.log(colors.bgYellow().black(" No failing tests found. Running all the tests "));
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
config.filters.tests = tests;
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.log(colors.bgRed().black(" Unable to read failed tests. Running all the tests "));
|
|
64
|
+
console.log(colors.red(error));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
40
67
|
};
|
|
68
|
+
|
|
69
|
+
// src/exceptions_manager.ts
|
|
70
|
+
import { ErrorsPrinter } from "@japa/errors-printer";
|
|
41
71
|
var ExceptionsManager = class {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
72
|
+
#exceptionsBuffer = [];
|
|
73
|
+
#rejectionsBuffer = [];
|
|
74
|
+
#state = "watching";
|
|
75
|
+
#errorsPrinter = new ErrorsPrinter({ stackLinesCount: 2, framesMaxLimit: 4 });
|
|
76
|
+
hasErrors = false;
|
|
77
|
+
/**
|
|
78
|
+
* Monitors unhandled exceptions and rejections. The exceptions
|
|
79
|
+
* are stacked in a buffer, so that we do not clutter the
|
|
80
|
+
* tests output and once the tests are over, we will
|
|
81
|
+
* print them to the console.
|
|
82
|
+
*
|
|
83
|
+
* In case the tests are completed, we will print errors as they
|
|
84
|
+
* happen.
|
|
85
|
+
*/
|
|
86
|
+
monitor() {
|
|
87
|
+
process.on("uncaughtException", async (error) => {
|
|
88
|
+
debug_default("received uncaught exception %O", error);
|
|
89
|
+
this.hasErrors = true;
|
|
90
|
+
if (this.#state === "watching") {
|
|
91
|
+
this.#exceptionsBuffer.push(error);
|
|
92
|
+
} else {
|
|
93
|
+
this.#errorsPrinter.printSectionBorder("[Unhandled Error]");
|
|
94
|
+
await this.#errorsPrinter.printError(error);
|
|
95
|
+
process.exitCode = 1;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
process.on("unhandledRejection", async (error) => {
|
|
99
|
+
debug_default("received unhandled rejection %O", error);
|
|
100
|
+
this.hasErrors = true;
|
|
101
|
+
if (this.#state === "watching") {
|
|
102
|
+
this.#rejectionsBuffer.push(error);
|
|
103
|
+
} else {
|
|
104
|
+
this.#errorsPrinter.printSectionBorder("[Unhandled Rejection]");
|
|
105
|
+
await this.#errorsPrinter.printError(error);
|
|
106
|
+
process.exitCode = 1;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
async report() {
|
|
111
|
+
if (this.#state === "reporting") {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
this.#state = "reporting";
|
|
115
|
+
if (this.#exceptionsBuffer.length) {
|
|
116
|
+
let exceptionsCount = this.#exceptionsBuffer.length;
|
|
117
|
+
let exceptionsIndex = this.#exceptionsBuffer.length;
|
|
118
|
+
this.#errorsPrinter.printSectionHeader("Unhandled Errors");
|
|
119
|
+
for (let exception of this.#exceptionsBuffer) {
|
|
120
|
+
await this.#errorsPrinter.printError(exception);
|
|
121
|
+
this.#errorsPrinter.printSectionBorder(`[${++exceptionsIndex}/${exceptionsCount}]`);
|
|
122
|
+
}
|
|
123
|
+
this.#exceptionsBuffer = [];
|
|
124
|
+
}
|
|
125
|
+
if (this.#rejectionsBuffer.length) {
|
|
126
|
+
let rejectionsCount = this.#exceptionsBuffer.length;
|
|
127
|
+
let rejectionsIndex = this.#exceptionsBuffer.length;
|
|
128
|
+
this.#errorsPrinter.printSectionBorder("Unhandled Rejections");
|
|
129
|
+
for (let rejection of this.#rejectionsBuffer) {
|
|
130
|
+
await this.#errorsPrinter.printError(rejection);
|
|
131
|
+
this.#errorsPrinter.printSectionBorder(`[${++rejectionsIndex}/${rejectionsCount}]`);
|
|
132
|
+
}
|
|
133
|
+
this.#rejectionsBuffer = [];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
// index.ts
|
|
139
|
+
var emitter = new Emitter();
|
|
140
|
+
var activeTest;
|
|
141
|
+
var cliArgs = {};
|
|
142
|
+
var runnerConfig;
|
|
143
|
+
var executionPlanState = {
|
|
144
|
+
phase: "idle"
|
|
96
145
|
};
|
|
97
|
-
const emitter = new Emitter();
|
|
98
|
-
let activeTest;
|
|
99
|
-
let cliArgs = {};
|
|
100
|
-
let runnerConfig;
|
|
101
|
-
const executionPlanState = { phase: "idle" };
|
|
102
146
|
function test(title, callback) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
147
|
+
validator_default.ensureIsInPlanningPhase(executionPlanState.phase);
|
|
148
|
+
const debuggingError = new Error();
|
|
149
|
+
const testInstance = createTest(
|
|
150
|
+
title,
|
|
151
|
+
emitter,
|
|
152
|
+
runnerConfig.refiner,
|
|
153
|
+
debuggingError,
|
|
154
|
+
executionPlanState
|
|
155
|
+
);
|
|
156
|
+
testInstance.setup((t) => {
|
|
157
|
+
activeTest = t;
|
|
158
|
+
return () => {
|
|
159
|
+
activeTest = void 0;
|
|
160
|
+
};
|
|
161
|
+
});
|
|
162
|
+
if (callback) {
|
|
163
|
+
testInstance.run(callback, debuggingError);
|
|
164
|
+
}
|
|
165
|
+
return testInstance;
|
|
114
166
|
}
|
|
115
167
|
test.group = function(title, callback) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
168
|
+
validator_default.ensureIsInPlanningPhase(executionPlanState.phase);
|
|
169
|
+
const group = createTestGroup(title, emitter, runnerConfig.refiner, executionPlanState);
|
|
170
|
+
executionPlanState.group = group;
|
|
171
|
+
if (cliArgs.bail && cliArgs.bailLayer === "group") {
|
|
172
|
+
executionPlanState.group.bail(true);
|
|
173
|
+
}
|
|
174
|
+
callback(executionPlanState.group);
|
|
175
|
+
executionPlanState.group = void 0;
|
|
176
|
+
return group;
|
|
123
177
|
};
|
|
124
178
|
test.macro = function(callback) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
179
|
+
return (...args) => {
|
|
180
|
+
if (!activeTest) {
|
|
181
|
+
throw new Error("Cannot invoke macro outside of the test callback");
|
|
182
|
+
}
|
|
183
|
+
return callback(activeTest, ...args);
|
|
184
|
+
};
|
|
129
185
|
};
|
|
130
186
|
function getActiveTest() {
|
|
131
|
-
|
|
187
|
+
return activeTest;
|
|
132
188
|
}
|
|
133
189
|
function getActiveTestOrFail() {
|
|
134
|
-
|
|
135
|
-
|
|
190
|
+
if (!activeTest) throw new Error("Cannot access active test outside of a test callback");
|
|
191
|
+
return activeTest;
|
|
136
192
|
}
|
|
137
193
|
function processCLIArgs(argv) {
|
|
138
|
-
|
|
194
|
+
cliArgs = new CliParser().parse(argv);
|
|
139
195
|
}
|
|
140
196
|
function configure(options) {
|
|
141
|
-
|
|
197
|
+
runnerConfig = new ConfigManager(options, cliArgs).hydrate();
|
|
142
198
|
}
|
|
143
199
|
async function run() {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
200
|
+
if (cliArgs.help) {
|
|
201
|
+
console.log(new CliParser().getHelp());
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
validator_default.ensureIsConfigured(runnerConfig);
|
|
205
|
+
executionPlanState.phase = "planning";
|
|
206
|
+
const runner = new Runner(emitter);
|
|
207
|
+
if (cliArgs.bail && cliArgs.bailLayer === "") {
|
|
208
|
+
runner.bail(true);
|
|
209
|
+
}
|
|
210
|
+
const globalHooks = new GlobalHooks();
|
|
211
|
+
const exceptionsManager = new ExceptionsManager();
|
|
212
|
+
try {
|
|
213
|
+
await retryPlugin({ config: runnerConfig, runner, emitter, cliArgs });
|
|
214
|
+
for (let plugin of runnerConfig.plugins) {
|
|
215
|
+
debug_default('executing "%s" plugin', plugin.name || "anonymous");
|
|
216
|
+
await plugin({ runner, emitter, cliArgs, config: runnerConfig });
|
|
217
|
+
}
|
|
218
|
+
const { config, reporters, suites, refinerFilters } = await new Planner(runnerConfig).plan();
|
|
219
|
+
reporters.forEach((reporter) => {
|
|
220
|
+
debug_default('registering "%s" reporter', reporter.name);
|
|
221
|
+
runner.registerReporter(reporter);
|
|
222
|
+
});
|
|
223
|
+
refinerFilters.forEach((filter) => {
|
|
224
|
+
debug_default('apply %s filters "%O" ', filter.layer, filter.filters);
|
|
225
|
+
config.refiner.add(filter.layer, filter.filters);
|
|
226
|
+
});
|
|
227
|
+
config.refiner.matchAllTags(cliArgs.matchAll ?? false);
|
|
228
|
+
runner.onSuite(config.configureSuite);
|
|
229
|
+
debug_default("executing global hooks");
|
|
230
|
+
globalHooks.apply(config);
|
|
231
|
+
if (!cliArgs.listPinned) {
|
|
232
|
+
await globalHooks.setup(runner);
|
|
233
|
+
}
|
|
234
|
+
for (let suite of suites) {
|
|
235
|
+
debug_default("initiating suite %s", suite.name);
|
|
236
|
+
executionPlanState.suite = new Suite(suite.name, emitter, config.refiner);
|
|
237
|
+
executionPlanState.retries = suite.retries;
|
|
238
|
+
executionPlanState.timeout = suite.timeout;
|
|
239
|
+
if (typeof suite.configure === "function") {
|
|
240
|
+
suite.configure(executionPlanState.suite);
|
|
241
|
+
}
|
|
242
|
+
if (cliArgs.bail && cliArgs.bailLayer === "suite") {
|
|
243
|
+
debug_default("enabling bail mode for the suite %s", suite.name);
|
|
244
|
+
executionPlanState.suite.bail(true);
|
|
245
|
+
}
|
|
246
|
+
runner.add(executionPlanState.suite);
|
|
247
|
+
for (let fileURL of suite.filesURLs) {
|
|
248
|
+
executionPlanState.file = fileURLToPath(fileURL);
|
|
249
|
+
debug_default("importing test file %s", executionPlanState.file);
|
|
250
|
+
await config.importer(fileURL);
|
|
251
|
+
}
|
|
252
|
+
executionPlanState.suite = void 0;
|
|
253
|
+
}
|
|
254
|
+
if (cliArgs.listPinned) {
|
|
255
|
+
printPinnedTests(runner);
|
|
256
|
+
if (config.forceExit) {
|
|
257
|
+
debug_default("force exiting process");
|
|
258
|
+
process.exit();
|
|
259
|
+
}
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
executionPlanState.phase = "executing";
|
|
263
|
+
exceptionsManager.monitor();
|
|
264
|
+
await runner.start();
|
|
265
|
+
await runner.exec();
|
|
266
|
+
await globalHooks.teardown(null, runner);
|
|
267
|
+
await runner.end();
|
|
268
|
+
await exceptionsManager.report();
|
|
269
|
+
const summary = runner.getSummary();
|
|
270
|
+
if (summary.hasError || exceptionsManager.hasErrors) {
|
|
271
|
+
debug_default(
|
|
272
|
+
"updating exit code to 1. summary.hasError %s, process.hasError",
|
|
273
|
+
summary.hasError,
|
|
274
|
+
exceptionsManager.hasErrors
|
|
275
|
+
);
|
|
276
|
+
process.exitCode = 1;
|
|
277
|
+
}
|
|
278
|
+
if (config.forceExit) {
|
|
279
|
+
debug_default("force exiting process");
|
|
280
|
+
process.exit();
|
|
281
|
+
}
|
|
282
|
+
} catch (error) {
|
|
283
|
+
debug_default("error running tests %O", error);
|
|
284
|
+
await globalHooks.teardown(error, runner);
|
|
285
|
+
const printer = new ErrorsPrinter2();
|
|
286
|
+
await printer.printError(error);
|
|
287
|
+
await exceptionsManager.report();
|
|
288
|
+
process.exitCode = 1;
|
|
289
|
+
if (runnerConfig.forceExit) {
|
|
290
|
+
debug_default("force exiting process");
|
|
291
|
+
process.exit();
|
|
292
|
+
}
|
|
293
|
+
}
|
|
237
294
|
}
|
|
238
|
-
export {
|
|
295
|
+
export {
|
|
296
|
+
configure,
|
|
297
|
+
getActiveTest,
|
|
298
|
+
getActiveTestOrFail,
|
|
299
|
+
processCLIArgs,
|
|
300
|
+
run,
|
|
301
|
+
test
|
|
302
|
+
};
|
|
@@ -1,2 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
BaseReporter,
|
|
3
|
+
Emitter,
|
|
4
|
+
Group,
|
|
5
|
+
Refiner,
|
|
6
|
+
Runner,
|
|
7
|
+
Suite,
|
|
8
|
+
Test,
|
|
9
|
+
TestContext
|
|
10
|
+
} from "../../chunk-L7YZLDZD.js";
|
|
11
|
+
import "../../chunk-2KG3PWR4.js";
|
|
12
|
+
export {
|
|
13
|
+
BaseReporter,
|
|
14
|
+
Emitter,
|
|
15
|
+
Group,
|
|
16
|
+
Refiner,
|
|
17
|
+
Runner,
|
|
18
|
+
Suite,
|
|
19
|
+
Test,
|
|
20
|
+
TestContext
|
|
21
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Emitter, Runner } from '../main.js';
|
|
2
2
|
import type { TestEndNode, SuiteEndNode, GroupEndNode, TestStartNode, RunnerSummary, RunnerEndNode, GroupStartNode, SuiteStartNode, RunnerStartNode, BaseReporterOptions } from '../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Base reporter to build custom reporters on top of
|
package/build/src/debug.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("
|
|
1
|
+
declare const _default: import("util").DebugLogger;
|
|
2
2
|
export default _default;
|
package/build/src/helpers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Colors } from '@poppinss/colors/types';
|
|
2
|
+
import { Runner, Test } from '../modules/core/main.js';
|
|
3
3
|
export declare const colors: Colors;
|
|
4
4
|
/**
|
|
5
5
|
* A collection of platform specific icons
|
package/build/src/hooks.d.ts
CHANGED
|
@@ -1,23 +1,31 @@
|
|
|
1
|
+
import "../../chunk-2KG3PWR4.js";
|
|
2
|
+
|
|
3
|
+
// src/plugins/disallow_pinned_tests.ts
|
|
1
4
|
import string from "@poppinss/string";
|
|
2
5
|
function disallowPinnedTests(options) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
const disallow = options?.disallow ?? true;
|
|
7
|
+
const errorMessage = options?.errorMessage ?? 'Pinning tests are disallowed by the "disallowPinnedTests" plugin. Use the "--list-pinned" flag to list pinned tests';
|
|
8
|
+
const pluginFn = async function disallowPinnedTestsPluginFn({ runner, emitter }) {
|
|
9
|
+
if (!disallow) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
function disallowPinned(test) {
|
|
13
|
+
if (test.isPinned) {
|
|
14
|
+
test.options.meta.abort(string.interpolate(errorMessage, { test: test.title }));
|
|
15
|
+
process.exitCode = 1;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
emitter.on("runner:start", () => {
|
|
19
|
+
runner.onSuite((suite) => {
|
|
20
|
+
suite.onGroup((group) => {
|
|
21
|
+
group.tap(disallowPinned);
|
|
22
|
+
});
|
|
23
|
+
suite.onTest(disallowPinned);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
return pluginFn;
|
|
22
28
|
}
|
|
23
|
-
export {
|
|
29
|
+
export {
|
|
30
|
+
disallowPinnedTests
|
|
31
|
+
};
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
dot,
|
|
3
|
+
github,
|
|
4
|
+
ndjson,
|
|
5
|
+
spec
|
|
6
|
+
} from "../../chunk-RFKFNXTE.js";
|
|
7
|
+
import "../../chunk-L7YZLDZD.js";
|
|
8
|
+
import "../../chunk-2KG3PWR4.js";
|
|
9
|
+
export {
|
|
10
|
+
dot,
|
|
11
|
+
github,
|
|
12
|
+
ndjson,
|
|
13
|
+
spec
|
|
14
|
+
};
|