@rstest/core 0.7.8 → 0.7.9
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 +294 -0
- package/dist/0~130.js +2 -2
- package/dist/0~1472.js +48 -0
- package/dist/0~1981.js +3 -0
- package/dist/0~2173.js +25 -10
- package/dist/0~2255.js +2 -2
- package/dist/0~3062.js +0 -5
- package/dist/0~3919.js +1 -1
- package/dist/0~4403.js +6 -5
- package/dist/0~4809.js +1 -1
- package/dist/0~5835.js +2 -2
- package/dist/0~62.js +1 -1
- package/dist/0~6588.js +3 -3
- package/dist/0~6923.js +2 -2
- package/dist/0~7583.js +9 -8
- package/dist/0~7882.js +1144 -0
- package/dist/0~8426.js +1 -2
- package/dist/0~89.js +24 -21
- package/dist/0~9348.js +953 -0
- package/dist/0~9634.js +58 -10
- package/dist/1157.js +12 -117
- package/dist/{7913.js → 1294.js} +51 -1745
- package/dist/2672.js +647 -0
- package/dist/3278.js +3 -450
- package/dist/4484.js +38 -0
- package/dist/487.js +1739 -0
- package/dist/4899.js +11 -0
- package/dist/5734.js +1 -1
- package/dist/{0~6151.js → 6151.js} +169 -13
- package/dist/{0~6973.js → 6973.js} +5 -5
- package/dist/721.js +9 -0
- package/dist/9131.js +554 -502
- package/dist/browser-runtime/2~907.js +1211 -0
- package/dist/browser-runtime/2~907.js.map +1 -0
- package/dist/browser-runtime/389.js +22071 -0
- package/dist/browser-runtime/389.js.LICENSE.txt +329 -0
- package/dist/browser-runtime/389.js.map +1 -0
- package/dist/browser-runtime/index.d.ts +2806 -0
- package/dist/browser-runtime/index.js +1 -0
- package/dist/browser-runtime/rslib-runtime.js +50 -0
- package/dist/browser-runtime/rslib-runtime.js.map +1 -0
- package/dist/browser.d.ts +3329 -0
- package/dist/browser.js +14 -0
- package/dist/globalSetupWorker.js +3 -2
- package/dist/index.d.ts +58 -1
- package/dist/index.js +2 -1
- package/dist/rslib-runtime.js +27 -0
- package/dist/rstestSuppressWarnings.cjs +9 -0
- package/dist/worker.d.ts +57 -1
- package/dist/worker.js +415 -1
- package/package.json +28 -13
- package/dist/0~8957.js +0 -149
- package/dist/554.js +0 -417
- package/dist/5693.js +0 -91
- /package/dist/{7913.js.LICENSE.txt → 1294.js.LICENSE.txt} +0 -0
- /package/dist/{0~6151.js.LICENSE.txt → 6151.js.LICENSE.txt} +0 -0
package/dist/0~9634.js
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
|
-
import "./
|
|
4
|
+
import { getTaskNameWithPrefix, bgColor } from "./2672.js";
|
|
5
5
|
import { prepareRsbuild, createPool, createRsbuildServer, runGlobalTeardown, runGlobalSetup } from "./0~89.js";
|
|
6
|
-
import { getTestEntries,
|
|
7
|
-
import { logger_logger } from "./3278.js";
|
|
8
|
-
const external_node_fs_ = __webpack_require__("
|
|
6
|
+
import { getTestEntries, prettyTestPath, ROOT_SUITE_NAME } from "./1157.js";
|
|
7
|
+
import { logger as logger_logger } from "./3278.js";
|
|
8
|
+
const external_node_fs_ = __webpack_require__("fs");
|
|
9
9
|
const external_node_path_ = __webpack_require__("node:path");
|
|
10
10
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
11
11
|
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
12
|
-
const
|
|
13
|
-
const { getSetupFiles } = await import("./
|
|
12
|
+
const collectNodeTests = async ({ context, nodeProjects, globTestSourceEntries })=>{
|
|
13
|
+
const { getSetupFiles } = await import("./6973.js").then((mod)=>({
|
|
14
14
|
getSetupFiles: mod.getSetupFiles
|
|
15
15
|
}));
|
|
16
|
-
|
|
16
|
+
if (0 === nodeProjects.length) return {
|
|
17
|
+
list: [],
|
|
18
|
+
getSourceMap: async (_name)=>null,
|
|
19
|
+
close: async ()=>{}
|
|
20
|
+
};
|
|
21
|
+
const setupFiles = Object.fromEntries(nodeProjects.map((project)=>{
|
|
17
22
|
const { environmentName, rootPath, normalizedConfig: { setupFiles } } = project;
|
|
18
23
|
return [
|
|
19
24
|
environmentName,
|
|
@@ -34,7 +39,7 @@ const collectTests = async ({ context, globTestSourceEntries })=>{
|
|
|
34
39
|
isWatchMode: false,
|
|
35
40
|
inspectedConfig: {
|
|
36
41
|
...context.normalizedConfig,
|
|
37
|
-
projects:
|
|
42
|
+
projects: nodeProjects.map((p)=>p.normalizedConfig)
|
|
38
43
|
},
|
|
39
44
|
setupFiles,
|
|
40
45
|
rsbuildInstance,
|
|
@@ -44,7 +49,7 @@ const collectTests = async ({ context, globTestSourceEntries })=>{
|
|
|
44
49
|
context
|
|
45
50
|
});
|
|
46
51
|
const updateSnapshot = context.snapshotManager.options.updateSnapshot;
|
|
47
|
-
const returns = await Promise.all(
|
|
52
|
+
const returns = await Promise.all(nodeProjects.map(async (project)=>{
|
|
48
53
|
const { entries, setupEntries, globalSetupEntries, getSourceMaps, getAssetFiles, assetNames } = await getRsbuildStats({
|
|
49
54
|
environmentName: project.environmentName
|
|
50
55
|
});
|
|
@@ -97,6 +102,20 @@ const collectTests = async ({ context, globTestSourceEntries })=>{
|
|
|
97
102
|
}
|
|
98
103
|
};
|
|
99
104
|
};
|
|
105
|
+
const collectBrowserTests = async ({ context, browserProjects })=>{
|
|
106
|
+
if (0 === browserProjects.length) return {
|
|
107
|
+
list: [],
|
|
108
|
+
close: async ()=>{}
|
|
109
|
+
};
|
|
110
|
+
const { loadBrowserModule } = await import("./0~1472.js").then((mod)=>({
|
|
111
|
+
loadBrowserModule: mod.loadBrowserModule
|
|
112
|
+
}));
|
|
113
|
+
const projectRoots = browserProjects.map((p)=>p.rootPath);
|
|
114
|
+
const { listBrowserTests } = await loadBrowserModule({
|
|
115
|
+
projectRoots
|
|
116
|
+
});
|
|
117
|
+
return listBrowserTests(context);
|
|
118
|
+
};
|
|
100
119
|
const collectTestFiles = async ({ context, globTestSourceEntries })=>{
|
|
101
120
|
const list = [];
|
|
102
121
|
for (const project of context.projects){
|
|
@@ -114,6 +133,35 @@ const collectTestFiles = async ({ context, globTestSourceEntries })=>{
|
|
|
114
133
|
getSourceMap: async (_name)=>null
|
|
115
134
|
};
|
|
116
135
|
};
|
|
136
|
+
const collectAllTests = async ({ context, globTestSourceEntries })=>{
|
|
137
|
+
const browserProjects = context.projects.filter((p)=>p.normalizedConfig.browser.enabled);
|
|
138
|
+
const nodeProjects = context.projects.filter((p)=>!p.normalizedConfig.browser.enabled);
|
|
139
|
+
const [nodeResult, browserResult] = await Promise.all([
|
|
140
|
+
collectNodeTests({
|
|
141
|
+
context,
|
|
142
|
+
nodeProjects,
|
|
143
|
+
globTestSourceEntries
|
|
144
|
+
}),
|
|
145
|
+
collectBrowserTests({
|
|
146
|
+
context,
|
|
147
|
+
browserProjects
|
|
148
|
+
})
|
|
149
|
+
]);
|
|
150
|
+
return {
|
|
151
|
+
errors: nodeResult.errors,
|
|
152
|
+
list: [
|
|
153
|
+
...nodeResult.list,
|
|
154
|
+
...browserResult.list
|
|
155
|
+
],
|
|
156
|
+
getSourceMap: nodeResult.getSourceMap,
|
|
157
|
+
close: async ()=>{
|
|
158
|
+
await Promise.all([
|
|
159
|
+
nodeResult.close(),
|
|
160
|
+
browserResult.close()
|
|
161
|
+
]);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
};
|
|
117
165
|
async function listTests(context, { filesOnly, json, printLocation, includeSuites }) {
|
|
118
166
|
const { rootPath } = context;
|
|
119
167
|
const testEntries = {};
|
|
@@ -134,7 +182,7 @@ async function listTests(context, { filesOnly, json, printLocation, includeSuite
|
|
|
134
182
|
const { list, close, getSourceMap, errors = [] } = filesOnly ? await collectTestFiles({
|
|
135
183
|
context,
|
|
136
184
|
globTestSourceEntries
|
|
137
|
-
}) : await
|
|
185
|
+
}) : await collectAllTests({
|
|
138
186
|
context,
|
|
139
187
|
globTestSourceEntries
|
|
140
188
|
});
|
package/dist/1157.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
import * as __rspack_external_node_fs_promises_153e37e0 from "node:fs/promises";
|
|
3
4
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
5
|
import { fileURLToPath } from "url";
|
|
5
6
|
import { createRequire } from "module";
|
|
6
|
-
import
|
|
7
|
-
import "./
|
|
8
|
-
import { normalize, isAbsolute, posix, join, parse } from "./3278.js";
|
|
7
|
+
import { castArray, parsePosix } from "./2672.js";
|
|
8
|
+
import { posix } from "./3278.js";
|
|
9
9
|
__webpack_require__.add({
|
|
10
10
|
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
11
11
|
const pico = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js");
|
|
@@ -1412,121 +1412,13 @@ __webpack_require__.add({
|
|
|
1412
1412
|
if ('' === last) return segs[segs.length - 2];
|
|
1413
1413
|
return last;
|
|
1414
1414
|
};
|
|
1415
|
+
},
|
|
1416
|
+
"node:fs/promises" (module) {
|
|
1417
|
+
module.exports = __rspack_external_node_fs_promises_153e37e0;
|
|
1415
1418
|
}
|
|
1416
1419
|
});
|
|
1417
|
-
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
1418
|
-
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
1419
|
-
const formatRootStr = (rootStr, root)=>rootStr.replace('<rootDir>', normalize(root));
|
|
1420
|
-
function getAbsolutePath(base, filepath) {
|
|
1421
|
-
return isAbsolute(filepath) ? filepath : join(base, filepath);
|
|
1422
|
-
}
|
|
1423
|
-
const parsePosix = (filePath)=>{
|
|
1424
|
-
const { dir, base } = parse(filePath);
|
|
1425
|
-
return {
|
|
1426
|
-
dir: dir.split("/").join('/'),
|
|
1427
|
-
base
|
|
1428
|
-
};
|
|
1429
|
-
};
|
|
1430
|
-
const isObject = (obj)=>'[object Object]' === Object.prototype.toString.call(obj);
|
|
1431
|
-
const castArray = (arr)=>{
|
|
1432
|
-
if (void 0 === arr) return [];
|
|
1433
|
-
return Array.isArray(arr) ? arr : [
|
|
1434
|
-
arr
|
|
1435
|
-
];
|
|
1436
|
-
};
|
|
1437
|
-
const isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && Object.getPrototypeOf(obj) === Object.prototype;
|
|
1438
|
-
function formatError(error) {
|
|
1439
|
-
if ('string' == typeof error || error instanceof Error) return error;
|
|
1440
|
-
if (isPlainObject(error) && error.message) {
|
|
1441
|
-
const e = new Error(error.name || 'unknown error');
|
|
1442
|
-
e.message = error.message;
|
|
1443
|
-
e.stack = error.stack;
|
|
1444
|
-
return e;
|
|
1445
|
-
}
|
|
1446
|
-
return String(error);
|
|
1447
|
-
}
|
|
1448
|
-
const prettyTime = (milliseconds)=>{
|
|
1449
|
-
if (milliseconds < 1000) return `${Math.round(milliseconds)}ms`;
|
|
1450
|
-
const seconds = milliseconds / 1000;
|
|
1451
|
-
const getSecond = (seconds, needDigits)=>{
|
|
1452
|
-
if (!needDigits || seconds === Math.ceil(seconds)) return `${Math.round(seconds).toString()}s`;
|
|
1453
|
-
const digits = seconds < 10 ? seconds >= 0.01 ? 2 : 3 : 1;
|
|
1454
|
-
return `${seconds.toFixed(digits)}s`;
|
|
1455
|
-
};
|
|
1456
|
-
const minutes = Math.floor(seconds / 60);
|
|
1457
|
-
const secondsRemainder = seconds % 60;
|
|
1458
|
-
let time = '';
|
|
1459
|
-
if (minutes > 0) time += `${minutes}m`;
|
|
1460
|
-
if (secondsRemainder > 0) {
|
|
1461
|
-
if (minutes > 0) time += ' ';
|
|
1462
|
-
time += getSecond(secondsRemainder, !minutes);
|
|
1463
|
-
}
|
|
1464
|
-
return time;
|
|
1465
|
-
};
|
|
1466
|
-
const getTaskNames = (test)=>(test.parentNames || []).concat(test.name).filter(Boolean);
|
|
1467
|
-
const getTaskNameWithPrefix = (test, delimiter = ">")=>getTaskNames(test).join(` ${delimiter} `);
|
|
1468
|
-
const REGEXP_FLAG_PREFIX = 'RSTEST_REGEXP:';
|
|
1469
|
-
const wrapRegex = (value)=>`${REGEXP_FLAG_PREFIX}${value.toString()}`;
|
|
1470
|
-
const unwrapRegex = (value)=>{
|
|
1471
|
-
if (value.startsWith(REGEXP_FLAG_PREFIX)) {
|
|
1472
|
-
const regexStr = value.slice(REGEXP_FLAG_PREFIX.length);
|
|
1473
|
-
const matches = regexStr.match(/^\/(.+)\/([gimuy]*)$/);
|
|
1474
|
-
if (matches) {
|
|
1475
|
-
const [, pattern, flags] = matches;
|
|
1476
|
-
return new RegExp(pattern, flags);
|
|
1477
|
-
}
|
|
1478
|
-
}
|
|
1479
|
-
return value;
|
|
1480
|
-
};
|
|
1481
|
-
const serializableConfig = (normalizedConfig)=>{
|
|
1482
|
-
const { testNamePattern } = normalizedConfig;
|
|
1483
|
-
return {
|
|
1484
|
-
...normalizedConfig,
|
|
1485
|
-
testNamePattern: testNamePattern && 'string' != typeof testNamePattern ? wrapRegex(testNamePattern) : testNamePattern
|
|
1486
|
-
};
|
|
1487
|
-
};
|
|
1488
|
-
const undoSerializableConfig = (normalizedConfig)=>{
|
|
1489
|
-
const { testNamePattern } = normalizedConfig;
|
|
1490
|
-
return {
|
|
1491
|
-
...normalizedConfig,
|
|
1492
|
-
testNamePattern: testNamePattern && 'string' == typeof testNamePattern ? unwrapRegex(testNamePattern) : testNamePattern
|
|
1493
|
-
};
|
|
1494
|
-
};
|
|
1495
|
-
const getNodeVersion = ()=>{
|
|
1496
|
-
if ('string' == typeof process.versions?.node) {
|
|
1497
|
-
const [major = 0, minor = 0, patch = 0] = process.versions.node.split('.').map(Number);
|
|
1498
|
-
return {
|
|
1499
|
-
major,
|
|
1500
|
-
minor,
|
|
1501
|
-
patch
|
|
1502
|
-
};
|
|
1503
|
-
}
|
|
1504
|
-
return {
|
|
1505
|
-
major: 0,
|
|
1506
|
-
minor: 0,
|
|
1507
|
-
patch: 0
|
|
1508
|
-
};
|
|
1509
|
-
};
|
|
1510
|
-
const needFlagExperimentalDetectModule = ()=>{
|
|
1511
|
-
const { major, minor } = getNodeVersion();
|
|
1512
|
-
if (20 === major && minor >= 10) return true;
|
|
1513
|
-
if (22 === major && minor < 7) return true;
|
|
1514
|
-
return false;
|
|
1515
|
-
};
|
|
1516
|
-
const ADDITIONAL_NODE_BUILTINS = [
|
|
1517
|
-
/^node:/,
|
|
1518
|
-
'pnpapi'
|
|
1519
|
-
];
|
|
1520
|
-
const bgColor = (background, str)=>{
|
|
1521
|
-
if ([
|
|
1522
|
-
'bgRed',
|
|
1523
|
-
'bgBlack'
|
|
1524
|
-
].includes(background)) return picocolors_default()[background](picocolors_default().white(picocolors_default().bold(str)));
|
|
1525
|
-
return picocolors_default()[background](picocolors_default().blackBright(picocolors_default().bold(str)));
|
|
1526
|
-
};
|
|
1527
|
-
const isTTY = (type = 'stdout')=>('stdin' === type ? process.stdin.isTTY : process.stdout.isTTY) && !process.env.CI;
|
|
1528
1420
|
const external_node_path_ = __webpack_require__("node:path");
|
|
1529
|
-
const external_node_fs_ = __webpack_require__("
|
|
1421
|
+
const external_node_fs_ = __webpack_require__("fs");
|
|
1530
1422
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
1531
1423
|
function cleanPath(path) {
|
|
1532
1424
|
let normalized = (0, external_node_path_.normalize)(path);
|
|
@@ -2318,6 +2210,9 @@ const globalApis = [
|
|
|
2318
2210
|
'onTestFailed'
|
|
2319
2211
|
];
|
|
2320
2212
|
const TS_CONFIG_FILE = 'tsconfig.json';
|
|
2213
|
+
const promises_ = __webpack_require__("node:fs/promises");
|
|
2214
|
+
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
2215
|
+
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
2321
2216
|
const filterFiles = (testFiles, filters, dir)=>{
|
|
2322
2217
|
if (!filters.length) return testFiles;
|
|
2323
2218
|
const fileFilters = 'win32' === process.platform ? filters.map((f)=>f.split(posix.sep).join('/')) : filters;
|
|
@@ -2361,7 +2256,7 @@ const getTestEntries = async ({ include, exclude, rootPath, projectRoot, fileFil
|
|
|
2361
2256
|
});
|
|
2362
2257
|
await Promise.all(sourceFiles.map(async (file)=>{
|
|
2363
2258
|
try {
|
|
2364
|
-
const code = await
|
|
2259
|
+
const code = await promises_["default"].readFile(file, 'utf-8');
|
|
2365
2260
|
if (hasInSourceTestCode(code)) testFiles.push(file);
|
|
2366
2261
|
} catch {
|
|
2367
2262
|
return;
|
|
@@ -2385,4 +2280,4 @@ const formatTestPath = (root, testFilePath)=>{
|
|
|
2385
2280
|
if (posix.isAbsolute(testPath) && testPath.includes(root)) testPath = posix.relative(root, testPath);
|
|
2386
2281
|
return prettyTestPath(testPath);
|
|
2387
2282
|
};
|
|
2388
|
-
export {
|
|
2283
|
+
export { DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME, ROOT_SUITE_NAME, TEMP_RSTEST_OUTPUT_DIR, TEMP_RSTEST_OUTPUT_DIR_GLOB, TS_CONFIG_FILE, filterProjects, formatTestEntryName, formatTestPath, getTestEntries, glob, globalApis, isDynamicPattern, prettyTestPath };
|