@rstest/core 0.7.3 → 0.7.4
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/dist/0~130.js +2 -1
- package/dist/0~151.js +18 -21
- package/dist/0~173.js +43 -6
- package/dist/0~255.js +2 -2
- package/dist/0~403.js +2 -1
- package/dist/0~426.js +5 -3
- package/dist/0~583.js +4 -3
- package/dist/0~588.js +5 -3
- package/dist/0~62.js +1 -1
- package/dist/0~634.js +52 -8
- package/dist/0~809.js +1 -1
- package/dist/0~835.js +4 -3
- package/dist/{0~122.js → 0~89.js} +117 -19
- package/dist/0~919.js +1 -1
- package/dist/0~923.js +4 -3
- package/dist/131.js +36 -18
- package/dist/{946.js → 157.js} +11 -854
- package/dist/198.js +4 -0
- package/dist/{404.js → 216.js} +1 -2
- package/dist/278.js +765 -0
- package/dist/554.js +6 -6715
- package/dist/664.js +93 -0
- package/dist/734.js +4 -3
- package/dist/913.js +6717 -0
- package/dist/globalSetupWorker.d.ts +9 -0
- package/dist/globalSetupWorker.js +115 -0
- package/dist/index.d.ts +152 -21
- package/dist/index.js +1 -1
- package/dist/worker.d.ts +150 -21
- package/package.json +2 -1
- /package/dist/{554.js.LICENSE.txt → 913.js.LICENSE.txt} +0 -0
package/dist/0~130.js
CHANGED
|
@@ -3,7 +3,8 @@ import 'module';
|
|
|
3
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
4
|
import { AssertionError, strict } from "node:assert";
|
|
5
5
|
import { Console } from "node:console";
|
|
6
|
-
import
|
|
6
|
+
import "./664.js";
|
|
7
|
+
import { prettyTime } from "./157.js";
|
|
7
8
|
const external_node_util_ = __webpack_require__("node:util");
|
|
8
9
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
9
10
|
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
package/dist/0~151.js
CHANGED
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
import 'module';
|
|
3
3
|
/*#__PURE__*/ import.meta.url;
|
|
4
4
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import "./664.js";
|
|
6
|
+
import { resolve as pathe_M_eThtNZ_resolve } from "./278.js";
|
|
7
|
+
import { getTaskNameWithPrefix, isObject as helper_isObject, castArray, ROOT_SUITE_NAME } from "./157.js";
|
|
8
|
+
import { getRealTimers, TestRegisterError, formatTestError, formatName } from "./913.js";
|
|
9
|
+
import { fileURLToPath } from "./198.js";
|
|
8
10
|
import { parse } from "./672.js";
|
|
11
|
+
import "./554.js";
|
|
9
12
|
__webpack_require__.add({
|
|
10
13
|
"../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/called-in-order.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
11
14
|
var every = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/array.js").every;
|
|
@@ -12200,9 +12203,11 @@ class TestRunner {
|
|
|
12200
12203
|
let result;
|
|
12201
12204
|
this.beforeEach(test, state, api);
|
|
12202
12205
|
const cleanups = [];
|
|
12206
|
+
const fixtureCleanups = await this.beforeRunTest(test, snapshotClient.getSnapshotState(testPath));
|
|
12207
|
+
cleanups.push(...fixtureCleanups);
|
|
12203
12208
|
try {
|
|
12204
12209
|
for (const fn of parentHooks.beforeEachListeners){
|
|
12205
|
-
const cleanupFn = await fn();
|
|
12210
|
+
const cleanupFn = await fn(test.context);
|
|
12206
12211
|
cleanupFn && cleanups.push(cleanupFn);
|
|
12207
12212
|
}
|
|
12208
12213
|
} catch (error) {
|
|
@@ -12217,8 +12222,6 @@ class TestRunner {
|
|
|
12217
12222
|
};
|
|
12218
12223
|
}
|
|
12219
12224
|
if (result?.status !== 'fail') if (test.fails) try {
|
|
12220
|
-
const fixtureCleanups = await this.beforeRunTest(test, snapshotClient.getSnapshotState(testPath));
|
|
12221
|
-
cleanups.push(...fixtureCleanups);
|
|
12222
12225
|
await test.fn?.(test.context);
|
|
12223
12226
|
this.afterRunTest(test);
|
|
12224
12227
|
result = {
|
|
@@ -12245,8 +12248,6 @@ class TestRunner {
|
|
|
12245
12248
|
};
|
|
12246
12249
|
}
|
|
12247
12250
|
else try {
|
|
12248
|
-
const fixtureCleanups = await this.beforeRunTest(test, snapshotClient.getSnapshotState(testPath));
|
|
12249
|
-
cleanups.push(...fixtureCleanups);
|
|
12250
12251
|
if (test.fn) {
|
|
12251
12252
|
const fn = wrapTimeout({
|
|
12252
12253
|
name: 'test',
|
|
@@ -12284,12 +12285,9 @@ class TestRunner {
|
|
|
12284
12285
|
const afterEachFns = [
|
|
12285
12286
|
...parentHooks.afterEachListeners || []
|
|
12286
12287
|
].reverse().concat(cleanups).concat(test.onFinished);
|
|
12288
|
+
test.context.task.result = result;
|
|
12287
12289
|
try {
|
|
12288
|
-
for (const fn of afterEachFns)await fn(
|
|
12289
|
-
task: {
|
|
12290
|
-
result
|
|
12291
|
-
}
|
|
12292
|
-
});
|
|
12290
|
+
for (const fn of afterEachFns)await fn(test.context);
|
|
12293
12291
|
} catch (error) {
|
|
12294
12292
|
result.status = 'fail';
|
|
12295
12293
|
result.errors ??= [];
|
|
@@ -12298,11 +12296,7 @@ class TestRunner {
|
|
|
12298
12296
|
if ('fail' === result.status) for (const fn of [
|
|
12299
12297
|
...test.onFailed
|
|
12300
12298
|
].reverse())try {
|
|
12301
|
-
await fn(
|
|
12302
|
-
task: {
|
|
12303
|
-
result
|
|
12304
|
-
}
|
|
12305
|
-
});
|
|
12299
|
+
await fn(test.context);
|
|
12306
12300
|
} catch (error) {
|
|
12307
12301
|
result.errors ??= [];
|
|
12308
12302
|
result.errors.push(...formatTestError(error));
|
|
@@ -12511,12 +12505,15 @@ class TestRunner {
|
|
|
12511
12505
|
if (unstubEnvs) api.rstest.unstubAllEnvs();
|
|
12512
12506
|
if (unstubGlobals) api.rstest.unstubAllGlobals();
|
|
12513
12507
|
}
|
|
12514
|
-
createTestContext() {
|
|
12508
|
+
createTestContext(test) {
|
|
12515
12509
|
const context = ()=>{
|
|
12516
12510
|
throw new Error('done() callback is deprecated, use promise instead');
|
|
12517
12511
|
};
|
|
12518
12512
|
let _expect;
|
|
12519
12513
|
const current = this._test;
|
|
12514
|
+
context.task = {
|
|
12515
|
+
name: test.name
|
|
12516
|
+
};
|
|
12520
12517
|
Object.defineProperty(context, 'expect', {
|
|
12521
12518
|
get: ()=>{
|
|
12522
12519
|
if (!_expect) _expect = createExpect({
|
|
@@ -12572,7 +12569,7 @@ class TestRunner {
|
|
|
12572
12569
|
snapshotState,
|
|
12573
12570
|
currentTestName: getTaskNameWithPrefix(test)
|
|
12574
12571
|
}, globalThis[GLOBAL_EXPECT]);
|
|
12575
|
-
const context = this.createTestContext();
|
|
12572
|
+
const context = this.createTestContext(test);
|
|
12576
12573
|
const { cleanups } = await handleFixtures(test, context);
|
|
12577
12574
|
Object.defineProperty(test, 'context', {
|
|
12578
12575
|
value: context,
|
|
@@ -12588,7 +12585,7 @@ class TestRunner {
|
|
|
12588
12585
|
if (true === isExpectingAssertions && 0 === assertionCalls) throw isExpectingAssertionsError;
|
|
12589
12586
|
}
|
|
12590
12587
|
}
|
|
12591
|
-
const external_node_path_ = __webpack_require__("path");
|
|
12588
|
+
const external_node_path_ = __webpack_require__("node:path");
|
|
12592
12589
|
class RunnerRuntime {
|
|
12593
12590
|
tests = [];
|
|
12594
12591
|
_currentTest = [];
|
package/dist/0~173.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
|
-
import
|
|
4
|
+
import "./664.js";
|
|
5
|
+
import { getTestEntries, getSetupFiles, isTTY } from "./157.js";
|
|
5
6
|
import { createCoverageProvider } from "./734.js";
|
|
6
|
-
import { prepareRsbuild, createPool, createRsbuildServer } from "./0~
|
|
7
|
+
import { prepareRsbuild, createPool, createRsbuildServer, runGlobalTeardown, runGlobalSetup } from "./0~89.js";
|
|
8
|
+
import { clearScreen, logger_logger } from "./278.js";
|
|
7
9
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
8
10
|
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
9
11
|
const isCliShortcutsEnabled = ()=>isTTY('stdin');
|
|
@@ -173,7 +175,14 @@ async function runTests(context) {
|
|
|
173
175
|
getSetupFiles(setupFiles, rootPath)
|
|
174
176
|
];
|
|
175
177
|
}));
|
|
176
|
-
const
|
|
178
|
+
const globalSetupFiles = Object.fromEntries(context.projects.map((project)=>{
|
|
179
|
+
const { environmentName, rootPath, normalizedConfig: { globalSetup } } = project;
|
|
180
|
+
return [
|
|
181
|
+
environmentName,
|
|
182
|
+
getSetupFiles(globalSetup, rootPath)
|
|
183
|
+
];
|
|
184
|
+
}));
|
|
185
|
+
const rsbuildInstance = await prepareRsbuild(context, globTestSourceEntries, setupFiles, globalSetupFiles);
|
|
177
186
|
const { getRsbuildStats, closeServer } = await createRsbuildServer({
|
|
178
187
|
inspectedConfig: {
|
|
179
188
|
...context.normalizedConfig,
|
|
@@ -184,6 +193,7 @@ async function runTests(context) {
|
|
|
184
193
|
return globTestSourceEntries(name);
|
|
185
194
|
},
|
|
186
195
|
setupFiles,
|
|
196
|
+
globalSetupFiles,
|
|
187
197
|
rsbuildInstance,
|
|
188
198
|
rootPath
|
|
189
199
|
});
|
|
@@ -200,11 +210,31 @@ async function runTests(context) {
|
|
|
200
210
|
const currentDeletedEntries = [];
|
|
201
211
|
context.stateManager.reset();
|
|
202
212
|
const returns = await Promise.all(context.projects.map(async (p)=>{
|
|
203
|
-
const { assetNames, entries, setupEntries, getAssetFiles, getSourceMaps, affectedEntries, deletedEntries } = await getRsbuildStats({
|
|
213
|
+
const { assetNames, entries, setupEntries, globalSetupEntries, getAssetFiles, getSourceMaps, affectedEntries, deletedEntries } = await getRsbuildStats({
|
|
204
214
|
environmentName: p.environmentName,
|
|
205
215
|
fileFilters
|
|
206
216
|
});
|
|
207
217
|
testStart ??= Date.now();
|
|
218
|
+
if (entries.length && globalSetupEntries.length && !p._globalSetups) {
|
|
219
|
+
p._globalSetups = true;
|
|
220
|
+
const files = globalSetupEntries.flatMap((e)=>e.files);
|
|
221
|
+
const assetFiles = await getAssetFiles(files);
|
|
222
|
+
const sourceMaps = await getSourceMaps(files);
|
|
223
|
+
const { success, errors } = await runGlobalSetup({
|
|
224
|
+
globalSetupEntries,
|
|
225
|
+
assetFiles,
|
|
226
|
+
sourceMaps,
|
|
227
|
+
interopDefault: true,
|
|
228
|
+
outputModule: p.outputModule
|
|
229
|
+
});
|
|
230
|
+
if (!success) return {
|
|
231
|
+
results: [],
|
|
232
|
+
testResults: [],
|
|
233
|
+
errors,
|
|
234
|
+
assetNames,
|
|
235
|
+
getSourceMaps: ()=>null
|
|
236
|
+
};
|
|
237
|
+
}
|
|
208
238
|
currentDeletedEntries.push(...deletedEntries);
|
|
209
239
|
let finalEntries = entries;
|
|
210
240
|
if ('on-demand' === mode) {
|
|
@@ -237,8 +267,9 @@ async function runTests(context) {
|
|
|
237
267
|
};
|
|
238
268
|
const results = returns.flatMap((r)=>r.results);
|
|
239
269
|
const testResults = returns.flatMap((r)=>r.testResults);
|
|
270
|
+
const errors = returns.flatMap((r)=>r.errors || []);
|
|
240
271
|
context.updateReporterResultState(results, testResults, currentDeletedEntries);
|
|
241
|
-
if (0 === results.length) {
|
|
272
|
+
if (0 === results.length && !errors.length) {
|
|
242
273
|
if ('watch' === command) if ('on-demand' === mode) logger_logger.log(picocolors_default().yellow('No test files need re-run.'));
|
|
243
274
|
else logger_logger.log(picocolors_default().yellow('No test files found.'));
|
|
244
275
|
else {
|
|
@@ -258,11 +289,12 @@ async function runTests(context) {
|
|
|
258
289
|
});
|
|
259
290
|
}
|
|
260
291
|
}
|
|
261
|
-
const isFailure = results.some((r)=>'fail' === r.status);
|
|
292
|
+
const isFailure = results.some((r)=>'fail' === r.status) || errors.length;
|
|
262
293
|
if (isFailure) process.exitCode = 1;
|
|
263
294
|
for (const reporter of reporters)await reporter.onTestRunEnd?.({
|
|
264
295
|
results: context.reporterResults.results,
|
|
265
296
|
testResults: context.reporterResults.testResults,
|
|
297
|
+
unhandledErrors: errors,
|
|
266
298
|
snapshotSummary: snapshotManager.summary,
|
|
267
299
|
duration,
|
|
268
300
|
getSourcemap: async (name)=>{
|
|
@@ -296,6 +328,7 @@ async function runTests(context) {
|
|
|
296
328
|
onBeforeRestart: mod.onBeforeRestart
|
|
297
329
|
}));
|
|
298
330
|
onBeforeRestart(async ()=>{
|
|
331
|
+
await runGlobalTeardown();
|
|
299
332
|
await pool.close();
|
|
300
333
|
await closeServer();
|
|
301
334
|
});
|
|
@@ -384,6 +417,9 @@ async function runTests(context) {
|
|
|
384
417
|
if (isTeardown) logger_logger.log(picocolors_default().yellow(`Rstest exited unexpectedly with code ${code}, this is likely caused by test environment teardown.`));
|
|
385
418
|
else {
|
|
386
419
|
logger_logger.log(picocolors_default().red(`Rstest exited unexpectedly with code ${code}, terminating test run.`));
|
|
420
|
+
runGlobalTeardown().catch((error)=>{
|
|
421
|
+
logger_logger.log(picocolors_default().red(`Error in global teardown: ${error}`));
|
|
422
|
+
});
|
|
387
423
|
process.exitCode = 1;
|
|
388
424
|
}
|
|
389
425
|
};
|
|
@@ -392,6 +428,7 @@ async function runTests(context) {
|
|
|
392
428
|
isTeardown = true;
|
|
393
429
|
await pool.close();
|
|
394
430
|
await closeServer();
|
|
431
|
+
await runGlobalTeardown();
|
|
395
432
|
process.off('exit', unExpectedExit);
|
|
396
433
|
}
|
|
397
434
|
}
|
package/dist/0~255.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
|
-
import "./
|
|
5
|
-
const external_node_fs_ = __webpack_require__("
|
|
4
|
+
import "./664.js";
|
|
5
|
+
const external_node_fs_ = __webpack_require__("fs");
|
|
6
6
|
const pluginCoverageCore = (coverageOptions)=>({
|
|
7
7
|
name: 'rstest:coverage-core',
|
|
8
8
|
setup: (api)=>{
|
package/dist/0~403.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
import { isDynamicPattern, glob
|
|
3
|
+
import { isDynamicPattern, glob } from "./157.js";
|
|
4
|
+
import { normalize, logger_logger } from "./278.js";
|
|
4
5
|
const getIncludedFiles = async (coverage, rootPath)=>{
|
|
5
6
|
const ignoredPatterns = coverage.exclude?.filter((item)=>isDynamicPattern(item) || item.startsWith(rootPath) || item.startsWith('./'));
|
|
6
7
|
const allFiles = await glob(coverage.include, {
|
package/dist/0~426.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
|
-
import
|
|
4
|
+
import "./157.js";
|
|
5
|
+
import "./664.js";
|
|
6
|
+
import { relative } from "./278.js";
|
|
5
7
|
const picomatch = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js");
|
|
6
8
|
var picomatch_default = /*#__PURE__*/ __webpack_require__.n(picomatch);
|
|
7
9
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
@@ -34,7 +36,7 @@ function checkThresholds({ coverageMap, thresholds, coverageProvider, rootPath }
|
|
|
34
36
|
if (THRESHOLD_KEYS.includes(key) || 'object' != typeof thresholds[key]) continue;
|
|
35
37
|
const globCoverageMap = coverageProvider.createCoverageMap();
|
|
36
38
|
const matcher = picomatch_default()(key);
|
|
37
|
-
const matchedFiles = allFiles.filter((file)=>matcher(
|
|
39
|
+
const matchedFiles = allFiles.filter((file)=>matcher(relative(rootPath, file)));
|
|
38
40
|
if (!matchedFiles.length) {
|
|
39
41
|
failedThresholds.push(`${picocolors_default().red('Error')}: coverage data for "${key}" was not found`);
|
|
40
42
|
continue;
|
|
@@ -57,7 +59,7 @@ function checkThresholds({ coverageMap, thresholds, coverageProvider, rootPath }
|
|
|
57
59
|
if (uncovered > -expected) errorMsg += `uncovered ${name} ${picocolors_default().red(`${uncovered}`)} exceeds maximum ${'global' === type ? 'global' : `"${type}"`} threshold allowed ${picocolors_default().yellow(`${-expected}`)}`;
|
|
58
60
|
} else if (actual.pct < expected) errorMsg += `coverage for ${name} ${picocolors_default().red(`${actual.pct}%`)} does not meet ${'global' === type ? 'global' : `"${type}"`} threshold ${picocolors_default().yellow(`${expected}%`)}`;
|
|
59
61
|
}
|
|
60
|
-
if (errorMsg) failedThresholds.push(`${picocolors_default().red('Error')}: ${file ? `${
|
|
62
|
+
if (errorMsg) failedThresholds.push(`${picocolors_default().red('Error')}: ${file ? `${relative(rootPath, file)} ` : ''}${errorMsg}`);
|
|
61
63
|
};
|
|
62
64
|
thresholdGroup.forEach(({ name, coverageMap, ...thresholds })=>{
|
|
63
65
|
const summaries = thresholds.perFile ? coverageMap.files().map((file)=>({
|
package/dist/0~583.js
CHANGED
|
@@ -4,9 +4,10 @@ import 'module';
|
|
|
4
4
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
5
5
|
import { lstat, open as promises_open, readdir, realpath as promises_realpath, stat as promises_stat } from "fs/promises";
|
|
6
6
|
import { Readable } from "node:stream";
|
|
7
|
-
import
|
|
7
|
+
import "./664.js";
|
|
8
|
+
import { readdir as promises_readdir, lstat as promises_lstat, promises_stat as promises_promises_stat, realpath as external_node_fs_promises_realpath } from "./157.js";
|
|
8
9
|
import { EventEmitter } from "./131.js";
|
|
9
|
-
const external_node_path_ = __webpack_require__("path");
|
|
10
|
+
const external_node_path_ = __webpack_require__("node:path");
|
|
10
11
|
const EntryTypes = {
|
|
11
12
|
FILE_TYPE: 'files',
|
|
12
13
|
DIR_TYPE: 'directories',
|
|
@@ -220,7 +221,7 @@ function readdirp(root, options = {}) {
|
|
|
220
221
|
options.root = root;
|
|
221
222
|
return new ReaddirpStream(options);
|
|
222
223
|
}
|
|
223
|
-
const external_node_fs_ = __webpack_require__("
|
|
224
|
+
const external_node_fs_ = __webpack_require__("fs");
|
|
224
225
|
const external_node_os_ = __webpack_require__("node:os");
|
|
225
226
|
const STR_DATA = 'data';
|
|
226
227
|
const STR_END = 'end';
|
package/dist/0~588.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
|
-
import
|
|
4
|
+
import "./664.js";
|
|
5
5
|
import { runRest } from "./131.js";
|
|
6
|
+
import { isTTY } from "./157.js";
|
|
7
|
+
import { logger_logger } from "./278.js";
|
|
6
8
|
const GLOB_REGEX = /[*?{}[\]()!@+|]/;
|
|
7
9
|
const isGlob = (str)=>GLOB_REGEX.test(str);
|
|
8
10
|
async function createChokidar(pathOrGlobs, root, options) {
|
|
@@ -16,7 +18,7 @@ async function createChokidar(pathOrGlobs, root, options) {
|
|
|
16
18
|
return false;
|
|
17
19
|
});
|
|
18
20
|
if (globPatterns.length) {
|
|
19
|
-
const { glob } = await import("./
|
|
21
|
+
const { glob } = await import("./157.js").then((mod)=>({
|
|
20
22
|
glob: mod.glob
|
|
21
23
|
}));
|
|
22
24
|
const files = await glob(globPatterns, {
|
|
@@ -27,7 +29,7 @@ async function createChokidar(pathOrGlobs, root, options) {
|
|
|
27
29
|
}
|
|
28
30
|
return chokidar.watch(Array.from(watchFiles), options);
|
|
29
31
|
}
|
|
30
|
-
const external_node_path_ = __webpack_require__("path");
|
|
32
|
+
const external_node_path_ = __webpack_require__("node:path");
|
|
31
33
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
32
34
|
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
33
35
|
let cleaners = [];
|
package/dist/0~62.js
CHANGED
package/dist/0~634.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
|
-
import
|
|
5
|
-
import { prepareRsbuild, createPool, createRsbuildServer } from "./0~
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import "./664.js";
|
|
5
|
+
import { prepareRsbuild, createPool, createRsbuildServer, runGlobalTeardown, runGlobalSetup } from "./0~89.js";
|
|
6
|
+
import { getTestEntries, getSetupFiles, getTaskNameWithPrefix, prettyTestPath, ROOT_SUITE_NAME, bgColor } from "./157.js";
|
|
7
|
+
import { logger_logger } from "./278.js";
|
|
8
|
+
const external_node_fs_ = __webpack_require__("fs");
|
|
9
|
+
const external_node_path_ = __webpack_require__("node:path");
|
|
8
10
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
9
11
|
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
10
12
|
const collectTests = async ({ context, globTestSourceEntries })=>{
|
|
@@ -15,9 +17,17 @@ const collectTests = async ({ context, globTestSourceEntries })=>{
|
|
|
15
17
|
getSetupFiles(setupFiles, rootPath)
|
|
16
18
|
];
|
|
17
19
|
}));
|
|
18
|
-
const
|
|
20
|
+
const globalSetupFiles = Object.fromEntries(context.projects.map((project)=>{
|
|
21
|
+
const { environmentName, rootPath, normalizedConfig: { globalSetup } } = project;
|
|
22
|
+
return [
|
|
23
|
+
environmentName,
|
|
24
|
+
getSetupFiles(globalSetup, rootPath)
|
|
25
|
+
];
|
|
26
|
+
}));
|
|
27
|
+
const rsbuildInstance = await prepareRsbuild(context, globTestSourceEntries, setupFiles, globalSetupFiles);
|
|
19
28
|
const { getRsbuildStats, closeServer } = await createRsbuildServer({
|
|
20
29
|
globTestSourceEntries,
|
|
30
|
+
globalSetupFiles,
|
|
21
31
|
inspectedConfig: {
|
|
22
32
|
...context.normalizedConfig,
|
|
23
33
|
projects: context.projects.map((p)=>p.normalizedConfig)
|
|
@@ -31,9 +41,28 @@ const collectTests = async ({ context, globTestSourceEntries })=>{
|
|
|
31
41
|
});
|
|
32
42
|
const updateSnapshot = context.snapshotManager.options.updateSnapshot;
|
|
33
43
|
const returns = await Promise.all(context.projects.map(async (project)=>{
|
|
34
|
-
const { entries, setupEntries, getSourceMaps, getAssetFiles, assetNames } = await getRsbuildStats({
|
|
44
|
+
const { entries, setupEntries, globalSetupEntries, getSourceMaps, getAssetFiles, assetNames } = await getRsbuildStats({
|
|
35
45
|
environmentName: project.environmentName
|
|
36
46
|
});
|
|
47
|
+
if (entries.length && globalSetupEntries.length && !project._globalSetups) {
|
|
48
|
+
project._globalSetups = true;
|
|
49
|
+
const files = globalSetupEntries.flatMap((e)=>e.files);
|
|
50
|
+
const assetFiles = await getAssetFiles(files);
|
|
51
|
+
const sourceMaps = await getSourceMaps(files);
|
|
52
|
+
const { success, errors } = await runGlobalSetup({
|
|
53
|
+
globalSetupEntries,
|
|
54
|
+
assetFiles,
|
|
55
|
+
sourceMaps,
|
|
56
|
+
interopDefault: true,
|
|
57
|
+
outputModule: project.outputModule
|
|
58
|
+
});
|
|
59
|
+
if (!success) return {
|
|
60
|
+
list: [],
|
|
61
|
+
errors,
|
|
62
|
+
assetNames,
|
|
63
|
+
getSourceMaps: ()=>null
|
|
64
|
+
};
|
|
65
|
+
}
|
|
37
66
|
const list = await pool.collectTests({
|
|
38
67
|
entries,
|
|
39
68
|
setupEntries,
|
|
@@ -50,6 +79,7 @@ const collectTests = async ({ context, globTestSourceEntries })=>{
|
|
|
50
79
|
}));
|
|
51
80
|
return {
|
|
52
81
|
list: returns.flatMap((r)=>r.list),
|
|
82
|
+
errors: returns.flatMap((r)=>r.errors || []),
|
|
53
83
|
getSourceMap: async (name)=>{
|
|
54
84
|
const resource = returns.find((r)=>r.assetNames.includes(name));
|
|
55
85
|
return (await resource?.getSourceMaps([
|
|
@@ -57,6 +87,7 @@ const collectTests = async ({ context, globTestSourceEntries })=>{
|
|
|
57
87
|
]))?.[name];
|
|
58
88
|
},
|
|
59
89
|
close: async ()=>{
|
|
90
|
+
await runGlobalTeardown();
|
|
60
91
|
await closeServer();
|
|
61
92
|
await pool.close();
|
|
62
93
|
}
|
|
@@ -74,6 +105,7 @@ const collectTestFiles = async ({ context, globTestSourceEntries })=>{
|
|
|
74
105
|
}
|
|
75
106
|
return {
|
|
76
107
|
close: async ()=>{},
|
|
108
|
+
errors: [],
|
|
77
109
|
list,
|
|
78
110
|
getSourceMap: async (_name)=>null
|
|
79
111
|
};
|
|
@@ -95,7 +127,7 @@ async function listTests(context, { filesOnly, json, printLocation, includeSuite
|
|
|
95
127
|
testEntries[name] = entries;
|
|
96
128
|
return entries;
|
|
97
129
|
};
|
|
98
|
-
const { list, close, getSourceMap } = filesOnly ? await collectTestFiles({
|
|
130
|
+
const { list, close, getSourceMap, errors = [] } = filesOnly ? await collectTestFiles({
|
|
99
131
|
context,
|
|
100
132
|
globTestSourceEntries
|
|
101
133
|
}) : await collectTests({
|
|
@@ -117,7 +149,7 @@ async function listTests(context, { filesOnly, json, printLocation, includeSuite
|
|
|
117
149
|
});
|
|
118
150
|
if ('suite' === test.type) for (const child of test.tests)traverseTests(child);
|
|
119
151
|
};
|
|
120
|
-
const hasError = list.some((file)=>file.errors?.length);
|
|
152
|
+
const hasError = list.some((file)=>file.errors?.length) || errors.length;
|
|
121
153
|
const showProject = context.projects.length > 1;
|
|
122
154
|
if (hasError) {
|
|
123
155
|
const { printError } = await import("./131.js").then((mod)=>({
|
|
@@ -134,6 +166,18 @@ async function listTests(context, { filesOnly, json, printLocation, includeSuite
|
|
|
134
166
|
}, rootPath);
|
|
135
167
|
}
|
|
136
168
|
}
|
|
169
|
+
if (errors.length) {
|
|
170
|
+
const { printError } = await import("./131.js").then((mod)=>({
|
|
171
|
+
printError: mod.error_printError
|
|
172
|
+
}));
|
|
173
|
+
for (const error of errors || []){
|
|
174
|
+
logger_logger.stderr(bgColor('bgRed', ' Unhandled Error '));
|
|
175
|
+
await printError(error, async (name)=>{
|
|
176
|
+
const sourceMap = await getSourceMap(name);
|
|
177
|
+
return sourceMap ? JSON.parse(sourceMap) : null;
|
|
178
|
+
}, rootPath);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
137
181
|
await close();
|
|
138
182
|
return list;
|
|
139
183
|
}
|
package/dist/0~809.js
CHANGED
package/dist/0~835.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
|
-
import {
|
|
5
|
-
import { pathToFileURL } from "./
|
|
4
|
+
import { createRequire as external_node_module_createRequire } from "./664.js";
|
|
5
|
+
import { pathToFileURL } from "./198.js";
|
|
6
6
|
import { node_vm, asModule, shouldInterop, interopModule } from "./0~346.js";
|
|
7
|
-
|
|
7
|
+
import { posix, logger_logger } from "./278.js";
|
|
8
|
+
const external_node_path_ = __webpack_require__("node:path");
|
|
8
9
|
const isRelativePath = (p)=>/^\.\.?\//.test(p);
|
|
9
10
|
const createRequire = (filename, distPath, rstestContext, assetFiles, interopDefault)=>{
|
|
10
11
|
const _require = (()=>{
|