@rstest/core 0.9.1 → 0.9.3
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/LICENSE.md +1 -1
- package/dist/{0~89.js → 0~8843.js} +24 -28
- package/dist/{0~1472.js → 0~browserLoader.js} +11 -11
- package/dist/{0~7882.js → 0~browser~1.js} +60 -61
- package/dist/{0~8426.js → 0~checkThresholds.js} +6 -6
- package/dist/{0~7583.js → 0~chokidar.js} +113 -72
- package/dist/{0~130.js → 0~console.js} +19 -20
- package/dist/{0~9744.js → 0~dist.js} +57 -57
- package/dist/{0~4403.js → 0~generate.js} +9 -6
- package/dist/{0~4809.js → 0~happyDom.js} +2 -2
- package/dist/{0~3346.js → 0~interop.js} +0 -1
- package/dist/{0~62.js → 0~jsdom.js} +2 -2
- package/dist/{0~262.js → 0~lib.js} +4 -1
- package/dist/{0~9634.js → 0~listTests.js} +15 -24
- package/dist/{0~6923.js → 0~loadEsModule.js} +7 -7
- package/dist/{0~5835.js → 0~loadModule.js} +11 -11
- package/dist/{0~6907.js → 0~magic-string.es.js} +2 -1
- package/dist/0~mergeReports.js +127 -0
- package/dist/{0~2255.js → 0~plugin.js} +2 -4
- package/dist/{0~6588.js → 0~restart.js} +8 -12
- package/dist/{0~2173.js → 0~runTests.js} +51 -60
- package/dist/{487.js → 1255.js} +22 -15
- package/dist/{6151.js → 1949.js} +41 -25
- package/dist/{6973.js → 255.js} +9 -10
- package/dist/{9131.js → 3145.js} +229 -479
- package/dist/{1157.js → 4411.js} +37 -37
- package/dist/{4484.js → 5040.js} +1 -2
- package/dist/{3160.js → 6830.js} +429 -106
- package/dist/7011.js +1 -1
- package/dist/{1294.js → 7552.js} +106 -83
- package/dist/{5734.js → 7704.js} +7 -6
- package/dist/browser-runtime/{2~907.js → 2~magic-string.es.js} +18 -11
- package/dist/browser-runtime/{389.js → 723.js} +178 -134
- package/dist/browser-runtime/{389.js.LICENSE.txt → 723.js.LICENSE.txt} +0 -22
- package/dist/browser-runtime/index.d.ts +40 -5
- package/dist/browser-runtime/index.js +1 -1
- package/dist/browser-runtime/rslib-runtime.js +11 -3
- package/dist/browser.d.ts +40 -5
- package/dist/browser.js +9 -7
- package/dist/globalSetupWorker.js +7 -14
- package/dist/index.d.ts +53 -6
- package/dist/index.js +2 -2
- package/dist/rslib-runtime.js +5 -8
- package/dist/worker.d.ts +30 -3
- package/dist/worker.js +20 -46
- package/package.json +19 -18
- package/dist/3160.js.LICENSE.txt +0 -21
- package/dist/4881.js +0 -2
- package/dist/6198.js +0 -2
- /package/dist/{0~7583.js.LICENSE.txt → 0~chokidar.js.LICENSE.txt} +0 -0
- /package/dist/{0~3062.js → 0~utils.js} +0 -0
- /package/dist/{6151.js.LICENSE.txt → 1949.js.LICENSE.txt} +0 -0
- /package/dist/{4597.js → 1983.js} +0 -0
- /package/dist/{1294.js.LICENSE.txt → 7552.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { existsSync, readFileSync, readdirSync, rmSync } from "node:fs";
|
|
3
|
+
import { createCoverageProvider } from "./7704.js";
|
|
4
|
+
import "./4411.js";
|
|
5
|
+
import { prettyTime, logger as logger_logger, relative, color as logger_color, join } from "./6830.js";
|
|
6
|
+
const DEFAULT_BLOB_DIR = '.rstest-reports';
|
|
7
|
+
function loadBlobFiles(blobDir) {
|
|
8
|
+
if (!existsSync(blobDir)) throw new Error(`Blob reports directory not found: ${logger_color.cyan(blobDir)}\nRun tests with --reporter=blob first to generate shard reports.`);
|
|
9
|
+
const files = readdirSync(blobDir).filter((f)=>/^blob(-\d+-\d+)?\.json$/.test(f)).sort();
|
|
10
|
+
if (0 === files.length) throw new Error(`No blob report files found in: ${logger_color.cyan(blobDir)}\nRun tests with --reporter=blob first to generate shard reports.`);
|
|
11
|
+
return files.map((file)=>{
|
|
12
|
+
const content = readFileSync(join(blobDir, file), 'utf-8');
|
|
13
|
+
return JSON.parse(content);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function mergeSnapshots(summaries) {
|
|
17
|
+
const merged = {
|
|
18
|
+
added: 0,
|
|
19
|
+
didUpdate: false,
|
|
20
|
+
failure: false,
|
|
21
|
+
filesAdded: 0,
|
|
22
|
+
filesRemoved: 0,
|
|
23
|
+
filesRemovedList: [],
|
|
24
|
+
filesUnmatched: 0,
|
|
25
|
+
filesUpdated: 0,
|
|
26
|
+
matched: 0,
|
|
27
|
+
total: 0,
|
|
28
|
+
unchecked: 0,
|
|
29
|
+
uncheckedKeysByFile: [],
|
|
30
|
+
unmatched: 0,
|
|
31
|
+
updated: 0
|
|
32
|
+
};
|
|
33
|
+
for (const s of summaries){
|
|
34
|
+
merged.added += s.added;
|
|
35
|
+
merged.filesAdded += s.filesAdded;
|
|
36
|
+
merged.filesRemoved += s.filesRemoved;
|
|
37
|
+
merged.filesRemovedList.push(...s.filesRemovedList);
|
|
38
|
+
merged.filesUnmatched += s.filesUnmatched;
|
|
39
|
+
merged.filesUpdated += s.filesUpdated;
|
|
40
|
+
merged.matched += s.matched;
|
|
41
|
+
merged.total += s.total;
|
|
42
|
+
merged.unchecked += s.unchecked;
|
|
43
|
+
merged.uncheckedKeysByFile.push(...s.uncheckedKeysByFile);
|
|
44
|
+
merged.unmatched += s.unmatched;
|
|
45
|
+
merged.updated += s.updated;
|
|
46
|
+
if (s.didUpdate) merged.didUpdate = true;
|
|
47
|
+
if (s.failure) merged.failure = true;
|
|
48
|
+
}
|
|
49
|
+
return merged;
|
|
50
|
+
}
|
|
51
|
+
function mergeDurations(durations) {
|
|
52
|
+
let totalTime = 0;
|
|
53
|
+
let buildTime = 0;
|
|
54
|
+
let testTime = 0;
|
|
55
|
+
for (const d of durations){
|
|
56
|
+
totalTime += d.totalTime;
|
|
57
|
+
buildTime += d.buildTime;
|
|
58
|
+
testTime += d.testTime;
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
totalTime,
|
|
62
|
+
buildTime,
|
|
63
|
+
testTime
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
async function mergeReports(context, options) {
|
|
67
|
+
const { path, cleanup } = options || {};
|
|
68
|
+
const blobDir = path ? join(context.rootPath, path) : join(context.rootPath, DEFAULT_BLOB_DIR);
|
|
69
|
+
const blobs = loadBlobFiles(blobDir);
|
|
70
|
+
const relativeBlobDir = relative(context.rootPath, blobDir) || '.';
|
|
71
|
+
logger_logger.log(`\nMerging ${logger_color.bold(String(blobs.length))} blob ${1 === blobs.length ? 'report' : 'reports'} from ${logger_color.cyan(relativeBlobDir)}\n`);
|
|
72
|
+
const allResults = [];
|
|
73
|
+
const allTestResults = [];
|
|
74
|
+
const allDurations = [];
|
|
75
|
+
const shardDurations = [];
|
|
76
|
+
const allSnapshotSummaries = [];
|
|
77
|
+
const allUnhandledErrors = [];
|
|
78
|
+
for (const blob of blobs){
|
|
79
|
+
allResults.push(...blob.results);
|
|
80
|
+
allTestResults.push(...blob.testResults);
|
|
81
|
+
allDurations.push(blob.duration);
|
|
82
|
+
allSnapshotSummaries.push(blob.snapshotSummary);
|
|
83
|
+
const shardLabel = blob.shard ? `Shard ${blob.shard.index}/${blob.shard.count}` : 'Shard';
|
|
84
|
+
shardDurations.push({
|
|
85
|
+
label: shardLabel,
|
|
86
|
+
duration: blob.duration
|
|
87
|
+
});
|
|
88
|
+
if (blob.unhandledErrors) for (const e of blob.unhandledErrors){
|
|
89
|
+
const error = new Error(e.message);
|
|
90
|
+
error.name = e.name || 'Error';
|
|
91
|
+
error.stack = e.stack;
|
|
92
|
+
allUnhandledErrors.push(error);
|
|
93
|
+
}
|
|
94
|
+
if (blob.consoleLogs) for (const log of blob.consoleLogs)for (const reporter of context.reporters)reporter.onUserConsoleLog?.(log);
|
|
95
|
+
}
|
|
96
|
+
const mergedDuration = mergeDurations(allDurations);
|
|
97
|
+
const mergedSnapshotSummary = mergeSnapshots(allSnapshotSummaries);
|
|
98
|
+
const hasFailure = allResults.some((r)=>'fail' === r.status) || allUnhandledErrors.length > 0;
|
|
99
|
+
if (hasFailure) process.exitCode = 1;
|
|
100
|
+
for (const reporter of context.reporters)await reporter.onTestRunStart?.();
|
|
101
|
+
for (const { label, duration } of shardDurations)logger_logger.log(logger_color.gray(` ${label}: ${prettyTime(duration.totalTime)} (build ${prettyTime(duration.buildTime)}, tests ${prettyTime(duration.testTime)})`));
|
|
102
|
+
if (shardDurations.length > 0) logger_logger.log('');
|
|
103
|
+
for (const result of allResults)for (const reporter of context.reporters)reporter.onTestFileResult?.(result);
|
|
104
|
+
for (const reporter of context.reporters)await reporter.onTestRunEnd?.({
|
|
105
|
+
results: allResults,
|
|
106
|
+
testResults: allTestResults,
|
|
107
|
+
duration: mergedDuration,
|
|
108
|
+
snapshotSummary: mergedSnapshotSummary,
|
|
109
|
+
unhandledErrors: allUnhandledErrors.length ? allUnhandledErrors : void 0,
|
|
110
|
+
getSourcemap: async ()=>null
|
|
111
|
+
});
|
|
112
|
+
const { coverage } = context.normalizedConfig;
|
|
113
|
+
if (coverage.enabled && (!hasFailure || coverage.reportOnFailure)) {
|
|
114
|
+
const coverageProvider = await createCoverageProvider(coverage, context.rootPath);
|
|
115
|
+
if (coverageProvider) {
|
|
116
|
+
const { generateCoverage } = await import("./0~generate.js");
|
|
117
|
+
await generateCoverage(context, allResults, coverageProvider);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (cleanup && existsSync(blobDir)) {
|
|
121
|
+
rmSync(blobDir, {
|
|
122
|
+
recursive: true
|
|
123
|
+
});
|
|
124
|
+
logger_logger.log(logger_color.gray(`Cleaned up blob reports directory: ${relativeBlobDir}\n`));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
export { mergeReports };
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import
|
|
3
|
-
import "./3160.js";
|
|
4
|
-
const external_node_fs_ = __webpack_require__("node:fs");
|
|
2
|
+
import node_fs from "node:fs";
|
|
5
3
|
const pluginCoverageCore = (coverageOptions)=>({
|
|
6
4
|
name: 'rstest:coverage-core',
|
|
7
5
|
setup: (api)=>{
|
|
8
6
|
api.onBeforeDevCompile(({ isFirstCompile })=>{
|
|
9
7
|
if (isFirstCompile && coverageOptions.clean) {
|
|
10
|
-
if (
|
|
8
|
+
if (node_fs.existsSync(coverageOptions.reportsDirectory)) node_fs.rmSync(coverageOptions.reportsDirectory, {
|
|
11
9
|
recursive: true
|
|
12
10
|
});
|
|
13
11
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import "./
|
|
3
|
+
import node_path from "node:path";
|
|
4
|
+
import { color as logger_color, logger as logger_logger, isTTY } from "./6830.js";
|
|
5
|
+
import { runRest } from "./3145.js";
|
|
6
|
+
import "./4411.js";
|
|
6
7
|
const GLOB_REGEX = /[*?{}[\]()!@+|]/;
|
|
7
8
|
const isGlob = (str)=>GLOB_REGEX.test(str);
|
|
8
9
|
async function createChokidar(pathOrGlobs, root, options) {
|
|
9
|
-
const chokidar = await import("./0~
|
|
10
|
-
watch: mod.watch
|
|
11
|
-
}));
|
|
10
|
+
const chokidar = await import("./0~chokidar.js");
|
|
12
11
|
const watchFiles = new Set();
|
|
13
12
|
const globPatterns = pathOrGlobs.filter((pathOrGlob)=>{
|
|
14
13
|
if (isGlob(pathOrGlob)) return true;
|
|
@@ -16,9 +15,7 @@ async function createChokidar(pathOrGlobs, root, options) {
|
|
|
16
15
|
return false;
|
|
17
16
|
});
|
|
18
17
|
if (globPatterns.length) {
|
|
19
|
-
const { glob } = await import("./
|
|
20
|
-
glob: mod.glob
|
|
21
|
-
}));
|
|
18
|
+
const { glob } = await import("./4411.js");
|
|
22
19
|
const files = await glob(globPatterns, {
|
|
23
20
|
cwd: root,
|
|
24
21
|
absolute: true
|
|
@@ -27,7 +24,6 @@ async function createChokidar(pathOrGlobs, root, options) {
|
|
|
27
24
|
}
|
|
28
25
|
return chokidar.watch(Array.from(watchFiles), options);
|
|
29
26
|
}
|
|
30
|
-
const external_node_path_ = __webpack_require__("path");
|
|
31
27
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
32
28
|
let cleaners = [];
|
|
33
29
|
const onBeforeRestart = (cleaner)=>{
|
|
@@ -39,8 +35,8 @@ const clearConsole = ()=>{
|
|
|
39
35
|
const beforeRestart = async ({ filePath, root, clear = true })=>{
|
|
40
36
|
if (clear) clearConsole();
|
|
41
37
|
if (filePath) {
|
|
42
|
-
const filename =
|
|
43
|
-
logger_logger.info(`restarting Rstest as ${
|
|
38
|
+
const filename = node_path.relative(root, filePath);
|
|
39
|
+
logger_logger.info(`restarting Rstest as ${logger_color.yellow(filename)} changed\n`);
|
|
44
40
|
} else logger_logger.info('restarting Rstest...\n');
|
|
45
41
|
for (const cleaner of cleaners)await cleaner();
|
|
46
42
|
cleaners = [];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
2
|
+
import { constants } from "node:os";
|
|
3
|
+
import { resolveShardedEntries, getTestEntries } from "./4411.js";
|
|
4
|
+
import { createCoverageProvider } from "./7704.js";
|
|
5
|
+
import { prepareRsbuild, createPool, createRsbuildServer, runGlobalTeardown, runGlobalSetup } from "./0~8843.js";
|
|
6
|
+
import { loadBrowserModule } from "./0~browserLoader.js";
|
|
7
|
+
import { logger as logger_logger, isTTY, color as logger_color, clearScreen } from "./6830.js";
|
|
8
8
|
const isCliShortcutsEnabled = ()=>isTTY('stdin');
|
|
9
9
|
async function setupCliShortcuts({ closeServer, runAll, updateSnapshot, runFailedTests, runWithTestNamePattern, runWithFileFilters }) {
|
|
10
10
|
const { createInterface, emitKeypressEvents } = await import("node:readline");
|
|
@@ -66,28 +66,28 @@ async function setupCliShortcuts({ closeServer, runAll, updateSnapshot, runFaile
|
|
|
66
66
|
const shortcuts = [
|
|
67
67
|
{
|
|
68
68
|
key: 'f',
|
|
69
|
-
description: `${
|
|
69
|
+
description: `${logger_color.bold('f')} ${logger_color.dim('rerun failed tests')}`,
|
|
70
70
|
action: async ()=>{
|
|
71
71
|
await runFailedTests();
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
key: 'a',
|
|
76
|
-
description: `${
|
|
76
|
+
description: `${logger_color.bold('a')} ${logger_color.dim('rerun all tests')}`,
|
|
77
77
|
action: async ()=>{
|
|
78
78
|
await runAll();
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
key: 'u',
|
|
83
|
-
description: `${
|
|
83
|
+
description: `${logger_color.bold('u')} ${logger_color.dim('update snapshot')}`,
|
|
84
84
|
action: async ()=>{
|
|
85
85
|
await updateSnapshot();
|
|
86
86
|
}
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
89
|
key: 't',
|
|
90
|
-
description: `${
|
|
90
|
+
description: `${logger_color.bold('t')} ${logger_color.dim('filter by a test name regex pattern')}`,
|
|
91
91
|
action: ()=>{
|
|
92
92
|
clearCurrentInputLine();
|
|
93
93
|
promptInput('Enter test name pattern (empty to clear): ', async (pattern)=>{
|
|
@@ -97,7 +97,7 @@ async function setupCliShortcuts({ closeServer, runAll, updateSnapshot, runFaile
|
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
key: 'p',
|
|
100
|
-
description: `${
|
|
100
|
+
description: `${logger_color.bold('p')} ${logger_color.dim('filter by a filename regex pattern')}`,
|
|
101
101
|
action: ()=>{
|
|
102
102
|
clearCurrentInputLine();
|
|
103
103
|
promptInput('Enter file name pattern (empty to clear): ', async (input)=>{
|
|
@@ -108,14 +108,14 @@ async function setupCliShortcuts({ closeServer, runAll, updateSnapshot, runFaile
|
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
110
|
key: 'c',
|
|
111
|
-
description: `${
|
|
111
|
+
description: `${logger_color.bold('c')} ${logger_color.dim('clear screen')}`,
|
|
112
112
|
action: ()=>{
|
|
113
113
|
clearScreen(true);
|
|
114
114
|
}
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
117
|
key: 'q',
|
|
118
|
-
description: `${
|
|
118
|
+
description: `${logger_color.bold('q')} ${logger_color.dim('quit process')}`,
|
|
119
119
|
action: async ()=>{
|
|
120
120
|
try {
|
|
121
121
|
await closeServer();
|
|
@@ -139,7 +139,7 @@ async function setupCliShortcuts({ closeServer, runAll, updateSnapshot, runFaile
|
|
|
139
139
|
}
|
|
140
140
|
if ('h' === str) {
|
|
141
141
|
clearCurrentInputLine();
|
|
142
|
-
let message = ` ${
|
|
142
|
+
let message = ` ${logger_color.bold(logger_color.blue('Shortcuts:'))}\n`;
|
|
143
143
|
for (const shortcut of shortcuts)message += ` ${shortcut.description}\n`;
|
|
144
144
|
logger_logger.log(message);
|
|
145
145
|
}
|
|
@@ -154,7 +154,6 @@ async function setupCliShortcuts({ closeServer, runAll, updateSnapshot, runFaile
|
|
|
154
154
|
rl.close();
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
|
-
const external_node_os_ = __webpack_require__("node:os");
|
|
158
157
|
async function runBrowserModeTests(context, browserProjects, options) {
|
|
159
158
|
const projectRoots = browserProjects.map((p)=>p.rootPath);
|
|
160
159
|
const { validateBrowserConfig, runBrowserTests } = await loadBrowserModule({
|
|
@@ -164,7 +163,7 @@ async function runBrowserModeTests(context, browserProjects, options) {
|
|
|
164
163
|
return runBrowserTests(context, options);
|
|
165
164
|
}
|
|
166
165
|
const getSignalExitCode = (signal)=>{
|
|
167
|
-
const signalNumber =
|
|
166
|
+
const signalNumber = constants.signals[signal];
|
|
168
167
|
return 'number' == typeof signalNumber ? 128 + signalNumber : 1;
|
|
169
168
|
};
|
|
170
169
|
async function runTests(context) {
|
|
@@ -176,16 +175,14 @@ async function runTests(context) {
|
|
|
176
175
|
const shouldUnifyReporter = !isWatchMode && hasBrowserProjects && hasNodeProjects;
|
|
177
176
|
if (hasBrowserProjects && !hasNodeProjects) {
|
|
178
177
|
const { coverage } = context.normalizedConfig;
|
|
179
|
-
if (coverage.enabled) logger_logger.log(` ${
|
|
178
|
+
if (coverage.enabled) logger_logger.log(` ${logger_color.gray('Coverage enabled with')} %s\n`, logger_color.yellow(coverage.provider));
|
|
180
179
|
const browserResult = await runBrowserModeTests(context, browserProjects, {
|
|
181
180
|
skipOnTestRunEnd: false
|
|
182
181
|
});
|
|
183
182
|
if (coverage.enabled && browserResult?.results.length && !browserResult.unhandledErrors?.length) {
|
|
184
183
|
const coverageProvider = await createCoverageProvider(coverage, context.rootPath);
|
|
185
184
|
if (coverageProvider) {
|
|
186
|
-
const { generateCoverage } = await import("./0~
|
|
187
|
-
generateCoverage: mod.generateCoverage
|
|
188
|
-
}));
|
|
185
|
+
const { generateCoverage } = await import("./0~generate.js");
|
|
189
186
|
await generateCoverage(context, browserResult.results, coverageProvider);
|
|
190
187
|
}
|
|
191
188
|
}
|
|
@@ -236,9 +233,7 @@ async function runTests(context) {
|
|
|
236
233
|
if (!hasNodeProjects) return;
|
|
237
234
|
}
|
|
238
235
|
const projects = nodeProjectsToRun;
|
|
239
|
-
const { getSetupFiles } = await import("./
|
|
240
|
-
getSetupFiles: mod.getSetupFiles
|
|
241
|
-
}));
|
|
236
|
+
const { getSetupFiles } = await import("./255.js");
|
|
242
237
|
const setupFiles = Object.fromEntries(projects.map((project)=>{
|
|
243
238
|
const { environmentName, rootPath, normalizedConfig: { setupFiles } } = project;
|
|
244
239
|
return [
|
|
@@ -280,7 +275,7 @@ async function runTests(context) {
|
|
|
280
275
|
recommendWorkerCount
|
|
281
276
|
});
|
|
282
277
|
const coverageProvider = coverage.enabled ? await createCoverageProvider(coverage, context.rootPath) : null;
|
|
283
|
-
if (coverageProvider) logger_logger.log(` ${
|
|
278
|
+
if (coverageProvider) logger_logger.log(` ${logger_color.gray('Coverage enabled with')} %s\n`, logger_color.yellow(coverage.provider));
|
|
284
279
|
const run = async ({ fileFilters, mode = 'all', buildStart = Date.now() } = {})=>{
|
|
285
280
|
for (const reporter of reporters)await reporter.onTestRunStart?.();
|
|
286
281
|
let testStart;
|
|
@@ -317,10 +312,10 @@ async function runTests(context) {
|
|
|
317
312
|
currentDeletedEntries.push(...deletedEntries);
|
|
318
313
|
let finalEntries = entries;
|
|
319
314
|
if ('on-demand' === mode) {
|
|
320
|
-
if (0 === affectedEntries.length) logger_logger.debug(
|
|
321
|
-
else logger_logger.debug(
|
|
315
|
+
if (0 === affectedEntries.length) logger_logger.debug(logger_color.yellow(`No test files need re-run in project(${p.environmentName}).`));
|
|
316
|
+
else logger_logger.debug(logger_color.yellow(`Test files to re-run in project(${p.environmentName}):\n`) + affectedEntries.map((e)=>e.testPath).join('\n') + '\n');
|
|
322
317
|
finalEntries = affectedEntries;
|
|
323
|
-
} else logger_logger.debug(
|
|
318
|
+
} else logger_logger.debug(logger_color.yellow(fileFilters?.length ? `Run filtered tests in project(${p.environmentName}).\n` : `Run all tests in project(${p.environmentName}).\n`));
|
|
324
319
|
currentEntries.push(...finalEntries);
|
|
325
320
|
const { results, testResults } = await pool.runTests({
|
|
326
321
|
entries: finalEntries,
|
|
@@ -375,25 +370,25 @@ async function runTests(context) {
|
|
|
375
370
|
const nodeHasFailure = results.some((r)=>'fail' === r.status) || errors.length;
|
|
376
371
|
const browserHasFailure = shouldUnifyReporter && browserResult?.hasFailure;
|
|
377
372
|
if (0 === results.length && !errors.length) {
|
|
378
|
-
if ('watch' === command) if ('on-demand' === mode) logger_logger.log(
|
|
379
|
-
else logger_logger.log(
|
|
373
|
+
if ('watch' === command) if ('on-demand' === mode) logger_logger.log(logger_color.yellow('No test files need re-run.'));
|
|
374
|
+
else logger_logger.log(logger_color.yellow('No test files found.'));
|
|
380
375
|
else {
|
|
381
376
|
const code = context.normalizedConfig.passWithNoTests ? 0 : 1;
|
|
382
377
|
const message = `No test files found, exiting with code ${code}.`;
|
|
383
|
-
if (0 === code) logger_logger.log(
|
|
384
|
-
else logger_logger.error(
|
|
378
|
+
if (0 === code) logger_logger.log(logger_color.yellow(message));
|
|
379
|
+
else logger_logger.error(logger_color.red(message));
|
|
385
380
|
process.exitCode = code;
|
|
386
381
|
}
|
|
387
382
|
if ('all' === mode) {
|
|
388
|
-
if (context.fileFilters?.length) logger_logger.log(
|
|
383
|
+
if (context.fileFilters?.length) logger_logger.log(logger_color.gray('filter: '), context.fileFilters.join(logger_color.gray(', ')));
|
|
389
384
|
allProjects.forEach((p)=>{
|
|
390
385
|
if (allProjects.length > 1) {
|
|
391
386
|
logger_logger.log('');
|
|
392
|
-
logger_logger.log(
|
|
387
|
+
logger_logger.log(logger_color.gray('project:'), p.name);
|
|
393
388
|
}
|
|
394
|
-
logger_logger.log(
|
|
395
|
-
logger_logger.log(
|
|
396
|
-
logger_logger.log(
|
|
389
|
+
logger_logger.log(logger_color.gray('root:'), p.rootPath);
|
|
390
|
+
logger_logger.log(logger_color.gray('include:'), p.normalizedConfig.include.join(logger_color.gray(', ')));
|
|
391
|
+
logger_logger.log(logger_color.gray('exclude:'), p.normalizedConfig.exclude.patterns.join(logger_color.gray(', ')));
|
|
397
392
|
});
|
|
398
393
|
}
|
|
399
394
|
}
|
|
@@ -409,14 +404,12 @@ async function runTests(context) {
|
|
|
409
404
|
filterRerunTestPaths: currentEntries.length ? currentEntries.map((e)=>e.testPath) : void 0
|
|
410
405
|
});
|
|
411
406
|
if (coverageProvider && (!isFailure || coverage.reportOnFailure)) {
|
|
412
|
-
const { generateCoverage } = await import("./0~
|
|
413
|
-
generateCoverage: mod.generateCoverage
|
|
414
|
-
}));
|
|
407
|
+
const { generateCoverage } = await import("./0~generate.js");
|
|
415
408
|
await generateCoverage(context, results, coverageProvider);
|
|
416
409
|
}
|
|
417
410
|
if (isFailure) {
|
|
418
411
|
const bail = context.normalizedConfig.bail;
|
|
419
|
-
if (bail && context.stateManager.getCountOfFailedTests() >= bail) logger_logger.log(
|
|
412
|
+
if (bail && context.stateManager.getCountOfFailedTests() >= bail) logger_logger.log(logger_color.yellow(`Test run aborted due to reaching the bail limit of ${bail} failed test(s).`));
|
|
420
413
|
}
|
|
421
414
|
} finally{
|
|
422
415
|
await browserClose?.();
|
|
@@ -433,11 +426,11 @@ async function runTests(context) {
|
|
|
433
426
|
await pool.close();
|
|
434
427
|
await closeServer();
|
|
435
428
|
} catch (error) {
|
|
436
|
-
logger_logger.log(
|
|
429
|
+
logger_logger.log(logger_color.red(`Error during cleanup: ${error}`));
|
|
437
430
|
}
|
|
438
431
|
};
|
|
439
432
|
const handleSignal = async (signal)=>{
|
|
440
|
-
logger_logger.log(
|
|
433
|
+
logger_logger.log(logger_color.yellow(`\nReceived ${signal}, cleaning up...`));
|
|
441
434
|
await cleanup();
|
|
442
435
|
process.exit(getSignalExitCode(signal));
|
|
443
436
|
};
|
|
@@ -445,13 +438,11 @@ async function runTests(context) {
|
|
|
445
438
|
process.on('SIGTERM', handleSignal);
|
|
446
439
|
process.on('SIGTSTP', handleSignal);
|
|
447
440
|
const afterTestsWatchRun = ()=>{
|
|
448
|
-
logger_logger.log(
|
|
449
|
-
if (enableCliShortcuts) if (snapshotManager.summary.unmatched) logger_logger.log(` ${
|
|
450
|
-
else logger_logger.log(` ${
|
|
441
|
+
logger_logger.log(logger_color.green(' Waiting for file changes...'));
|
|
442
|
+
if (enableCliShortcuts) if (snapshotManager.summary.unmatched) logger_logger.log(` ${logger_color.dim('press')} ${logger_color.yellow(logger_color.bold('u'))} ${logger_color.dim('to update snapshot')}${logger_color.dim(', press')} ${logger_color.bold('h')} ${logger_color.dim('to show help')}\n`);
|
|
443
|
+
else logger_logger.log(` ${logger_color.dim('press')} ${logger_color.bold('h')} ${logger_color.dim('to show help')}${logger_color.dim(', press')} ${logger_color.bold('q')} ${logger_color.dim('to quit')}\n`);
|
|
451
444
|
};
|
|
452
|
-
const { onBeforeRestart } = await import("./0~
|
|
453
|
-
onBeforeRestart: mod.onBeforeRestart
|
|
454
|
-
}));
|
|
445
|
+
const { onBeforeRestart } = await import("./0~restart.js");
|
|
455
446
|
onBeforeRestart(async ()=>{
|
|
456
447
|
await runGlobalTeardown();
|
|
457
448
|
await pool.close();
|
|
@@ -488,20 +479,20 @@ async function runTests(context) {
|
|
|
488
479
|
runWithTestNamePattern: async (pattern)=>{
|
|
489
480
|
clearScreen();
|
|
490
481
|
context.normalizedConfig.testNamePattern = pattern;
|
|
491
|
-
if (pattern) logger_logger.log(`\n${
|
|
492
|
-
else logger_logger.log(`\n${
|
|
482
|
+
if (pattern) logger_logger.log(`\n${logger_color.dim('Applied testNamePattern:')} ${logger_color.bold(pattern)}\n`);
|
|
483
|
+
else logger_logger.log(`\n${logger_color.dim('Cleared testNamePattern filter')}\n`);
|
|
493
484
|
snapshotManager.clear();
|
|
494
485
|
await run();
|
|
495
486
|
afterTestsWatchRun();
|
|
496
487
|
},
|
|
497
488
|
runWithFileFilters: async (filters)=>{
|
|
498
489
|
clearScreen();
|
|
499
|
-
if (filters && filters.length > 0) logger_logger.log(`\n${
|
|
500
|
-
else logger_logger.log(`\n${
|
|
490
|
+
if (filters && filters.length > 0) logger_logger.log(`\n${logger_color.dim('Applied file filters:')} ${logger_color.bold(filters.join(', '))}\n`);
|
|
491
|
+
else logger_logger.log(`\n${logger_color.dim('Cleared file filters')}\n`);
|
|
501
492
|
snapshotManager.clear();
|
|
502
493
|
context.fileFilters = filters;
|
|
503
494
|
const entries = await Promise.all(projects.map(async (p)=>globTestSourceEntries(p.environmentName))).then((entries)=>entries.reduce((acc, entry)=>acc.concat(...Object.values(entry)), []));
|
|
504
|
-
if (!entries.length) return void logger_logger.log(filters ?
|
|
495
|
+
if (!entries.length) return void logger_logger.log(filters ? logger_color.yellow(`\nNo matching test files to run with current file filters: ${filters.join(',')}\n`) : logger_color.yellow('\nNo matching test files to run.\n'));
|
|
505
496
|
await run({
|
|
506
497
|
fileFilters: entries
|
|
507
498
|
});
|
|
@@ -509,7 +500,7 @@ async function runTests(context) {
|
|
|
509
500
|
},
|
|
510
501
|
runFailedTests: async ()=>{
|
|
511
502
|
const failedTests = context.reporterResults.results.filter((result)=>'fail' === result.status).map((r)=>r.testPath);
|
|
512
|
-
if (!failedTests.length) return void logger_logger.log(
|
|
503
|
+
if (!failedTests.length) return void logger_logger.log(logger_color.yellow('\nNo failed tests were found that needed to be rerun.'));
|
|
513
504
|
clearScreen();
|
|
514
505
|
snapshotManager.clear();
|
|
515
506
|
await run({
|
|
@@ -519,7 +510,7 @@ async function runTests(context) {
|
|
|
519
510
|
afterTestsWatchRun();
|
|
520
511
|
},
|
|
521
512
|
updateSnapshot: async ()=>{
|
|
522
|
-
if (!snapshotManager.summary.unmatched) return void logger_logger.log(
|
|
513
|
+
if (!snapshotManager.summary.unmatched) return void logger_logger.log(logger_color.yellow('\nNo snapshots were found that needed to be updated.'));
|
|
523
514
|
const failedTests = context.reporterResults.results.filter((result)=>result.snapshotResult?.unmatched).map((r)=>r.testPath);
|
|
524
515
|
clearScreen();
|
|
525
516
|
const originalUpdateSnapshot = snapshotManager.options.updateSnapshot;
|
|
@@ -547,21 +538,21 @@ async function runTests(context) {
|
|
|
547
538
|
await pool.close();
|
|
548
539
|
await closeServer();
|
|
549
540
|
} catch (error) {
|
|
550
|
-
logger_logger.log(
|
|
541
|
+
logger_logger.log(logger_color.red(`Error during cleanup: ${error}`));
|
|
551
542
|
}
|
|
552
543
|
};
|
|
553
544
|
const unExpectedExit = (code)=>{
|
|
554
|
-
if (isTeardown) logger_logger.log(
|
|
545
|
+
if (isTeardown) logger_logger.log(logger_color.yellow(`Rstest exited unexpectedly with code ${code}, this is likely caused by test environment teardown.`));
|
|
555
546
|
else {
|
|
556
|
-
logger_logger.log(
|
|
547
|
+
logger_logger.log(logger_color.red(`Rstest exited unexpectedly with code ${code}, terminating test run.`));
|
|
557
548
|
runGlobalTeardown().catch((error)=>{
|
|
558
|
-
logger_logger.log(
|
|
549
|
+
logger_logger.log(logger_color.red(`Error in global teardown: ${error}`));
|
|
559
550
|
});
|
|
560
551
|
process.exitCode = 1;
|
|
561
552
|
}
|
|
562
553
|
};
|
|
563
554
|
const handleSignal = async (signal)=>{
|
|
564
|
-
logger_logger.log(
|
|
555
|
+
logger_logger.log(logger_color.yellow(`\nReceived ${signal}, cleaning up...`));
|
|
565
556
|
await cleanup();
|
|
566
557
|
process.exit(getSignalExitCode(signal));
|
|
567
558
|
};
|
package/dist/{487.js → 1255.js}
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
+
import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
|
|
3
|
+
import * as __rspack_external_node_path_c5b9b54f from "node:path";
|
|
2
4
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
3
|
-
import "./3160.js";
|
|
4
5
|
__webpack_require__.add({
|
|
5
6
|
"../../node_modules/.pnpm/buffer-from@1.1.2/node_modules/buffer-from/index.js" (module) {
|
|
6
7
|
var toString = Object.prototype.toString;
|
|
@@ -34,11 +35,11 @@ __webpack_require__.add({
|
|
|
34
35
|
},
|
|
35
36
|
"../../node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js" (module, exports, __webpack_require__) {
|
|
36
37
|
module = __webpack_require__.nmd(module);
|
|
37
|
-
var SourceMapConsumer = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/source-map.js").
|
|
38
|
-
var path = __webpack_require__("path");
|
|
38
|
+
var SourceMapConsumer = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/source-map.js").YK;
|
|
39
|
+
var path = __webpack_require__("path?7a8d");
|
|
39
40
|
var fs;
|
|
40
41
|
try {
|
|
41
|
-
fs = __webpack_require__("
|
|
42
|
+
fs = __webpack_require__("fs?6bb1");
|
|
42
43
|
if (!fs.existsSync || !fs.readFileSync) fs = null;
|
|
43
44
|
} catch (err) {}
|
|
44
45
|
var bufferFrom = __webpack_require__("../../node_modules/.pnpm/buffer-from@1.1.2/node_modules/buffer-from/index.js");
|
|
@@ -466,7 +467,7 @@ __webpack_require__.add({
|
|
|
466
467
|
ArraySet.prototype.toArray = function ArraySet_toArray() {
|
|
467
468
|
return this._array.slice();
|
|
468
469
|
};
|
|
469
|
-
exports.
|
|
470
|
+
exports.C = ArraySet;
|
|
470
471
|
},
|
|
471
472
|
"../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/base64-vlq.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
472
473
|
var base64 = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/base64.js");
|
|
@@ -600,7 +601,7 @@ __webpack_require__.add({
|
|
|
600
601
|
}
|
|
601
602
|
return this._array;
|
|
602
603
|
};
|
|
603
|
-
exports.
|
|
604
|
+
exports.P = MappingList;
|
|
604
605
|
},
|
|
605
606
|
"../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/quick-sort.js" (__unused_rspack_module, exports) {
|
|
606
607
|
function swap(ary, x, y) {
|
|
@@ -627,16 +628,16 @@ __webpack_require__.add({
|
|
|
627
628
|
doQuickSort(ary, comparator, q + 1, r);
|
|
628
629
|
}
|
|
629
630
|
}
|
|
630
|
-
exports.
|
|
631
|
+
exports.g = function(ary, comparator) {
|
|
631
632
|
doQuickSort(ary, comparator, 0, ary.length - 1);
|
|
632
633
|
};
|
|
633
634
|
},
|
|
634
635
|
"../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/source-map-consumer.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
635
636
|
var util = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/util.js");
|
|
636
637
|
var binarySearch = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/binary-search.js");
|
|
637
|
-
var ArraySet = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/array-set.js").
|
|
638
|
+
var ArraySet = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/array-set.js").C;
|
|
638
639
|
var base64VLQ = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/base64-vlq.js");
|
|
639
|
-
var quickSort = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/quick-sort.js").
|
|
640
|
+
var quickSort = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/quick-sort.js").g;
|
|
640
641
|
function SourceMapConsumer(aSourceMap, aSourceMapURL) {
|
|
641
642
|
var sourceMap = aSourceMap;
|
|
642
643
|
if ('string' == typeof aSourceMap) sourceMap = util.parseSourceMapInput(aSourceMap);
|
|
@@ -1112,8 +1113,8 @@ __webpack_require__.add({
|
|
|
1112
1113
|
"../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/source-map-generator.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
1113
1114
|
var base64VLQ = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/base64-vlq.js");
|
|
1114
1115
|
var util = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/util.js");
|
|
1115
|
-
var ArraySet = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/array-set.js").
|
|
1116
|
-
var MappingList = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/mapping-list.js").
|
|
1116
|
+
var ArraySet = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/array-set.js").C;
|
|
1117
|
+
var MappingList = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/mapping-list.js").P;
|
|
1117
1118
|
function SourceMapGenerator(aArgs) {
|
|
1118
1119
|
if (!aArgs) aArgs = {};
|
|
1119
1120
|
this._file = util.getArg(aArgs, 'file', null);
|
|
@@ -1313,10 +1314,10 @@ __webpack_require__.add({
|
|
|
1313
1314
|
SourceMapGenerator.prototype.toString = function SourceMapGenerator_toString() {
|
|
1314
1315
|
return JSON.stringify(this.toJSON());
|
|
1315
1316
|
};
|
|
1316
|
-
exports.
|
|
1317
|
+
exports.x = SourceMapGenerator;
|
|
1317
1318
|
},
|
|
1318
1319
|
"../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/source-node.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
1319
|
-
var SourceMapGenerator = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/source-map-generator.js").
|
|
1320
|
+
var SourceMapGenerator = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/source-map-generator.js").x;
|
|
1320
1321
|
var util = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/util.js");
|
|
1321
1322
|
var REGEX_NEWLINE = /(\r?\n)/;
|
|
1322
1323
|
var NEWLINE_CODE = 10;
|
|
@@ -1727,9 +1728,15 @@ __webpack_require__.add({
|
|
|
1727
1728
|
exports.computeSourceURL = computeSourceURL;
|
|
1728
1729
|
},
|
|
1729
1730
|
"../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/source-map.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
1730
|
-
__webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/source-map-generator.js").
|
|
1731
|
-
exports.
|
|
1731
|
+
__webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/source-map-generator.js").x;
|
|
1732
|
+
exports.YK = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/source-map-consumer.js").SourceMapConsumer;
|
|
1732
1733
|
__webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/source-node.js");
|
|
1734
|
+
},
|
|
1735
|
+
"fs?6bb1" (module) {
|
|
1736
|
+
module.exports = __rspack_external_node_fs_5ea92f0c;
|
|
1737
|
+
},
|
|
1738
|
+
"path?7a8d" (module) {
|
|
1739
|
+
module.exports = __rspack_external_node_path_c5b9b54f;
|
|
1733
1740
|
}
|
|
1734
1741
|
});
|
|
1735
1742
|
const gracefulExit = process.execArgv.some((execArg)=>execArg.startsWith('--perf') || execArg.startsWith('--prof') || execArg.startsWith('--cpu-prof') || execArg.startsWith('--heap-prof') || execArg.startsWith('--diagnostic-dir'));
|