@rstest/core 0.2.1 → 0.3.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/dist/{359.js → 12.js} +156 -94
- package/dist/{72.js → 171.js} +2 -1
- package/dist/223.js +135 -0
- package/dist/{920.js → 33.js} +125 -81
- package/dist/{44.js → 350.js} +6 -5
- package/dist/{813.js → 607.js} +16 -15
- package/dist/{208.js → 655.js} +60 -59
- package/dist/{355.js → 704.js} +17 -16
- package/dist/{965.js → 711.js} +6 -5
- package/dist/{443.js → 755.js} +2 -1
- package/dist/{723.js → 829.js} +5 -4
- package/dist/{867.js → 85.js} +140 -67
- package/dist/{668.js → 928.js} +3 -2
- package/dist/{25.js → 967.js} +19 -14
- package/dist/{64.js → 969.js} +2 -1
- package/dist/{285.js → 971.js} +66 -33
- package/dist/{854.js → 985.js} +153 -81
- package/dist/index.js +93 -121
- package/dist/worker.js +45 -38
- package/dist-types/index.d.ts +55 -3
- package/dist-types/worker.d.ts +124 -4
- package/globals.d.ts +2 -0
- package/package.json +6 -6
- /package/dist/{208.js.LICENSE.txt → 655.js.LICENSE.txt} +0 -0
- /package/dist/{668.js.LICENSE.txt → 928.js.LICENSE.txt} +0 -0
package/dist/{359.js → 12.js}
RENAMED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
export const __webpack_id__ = "12";
|
|
3
4
|
export const __webpack_ids__ = [
|
|
4
|
-
"
|
|
5
|
+
"12"
|
|
5
6
|
];
|
|
6
7
|
export const __webpack_modules__ = {
|
|
7
8
|
"../../node_modules/.pnpm/stacktrace-parser@0.1.11/node_modules/stacktrace-parser/dist/stack-trace-parser.esm.js": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8
9
|
__webpack_require__.d(__webpack_exports__, {
|
|
9
|
-
|
|
10
|
+
q: ()=>parse
|
|
10
11
|
});
|
|
11
12
|
var UNKNOWN_FUNCTION = '<unknown>';
|
|
12
13
|
function parse(stackString) {
|
|
@@ -300,7 +301,7 @@ export const __webpack_modules__ = {
|
|
|
300
301
|
const summary = [];
|
|
301
302
|
for (const module of this.runningModules){
|
|
302
303
|
const relativePath = (0, external_pathe_.relative)(this.rootPath, module);
|
|
303
|
-
summary.push(`${utils
|
|
304
|
+
summary.push(`${utils.yW.bgYellow(utils.yW.bold(' RUNS '))} ${(0, utils.EQ)(relativePath)}`);
|
|
304
305
|
}
|
|
305
306
|
summary.push('');
|
|
306
307
|
return summary;
|
|
@@ -319,70 +320,70 @@ export const __webpack_modules__ = {
|
|
|
319
320
|
}
|
|
320
321
|
}
|
|
321
322
|
const getSummaryStatusString = (tasks, name = 'tests', showTotal = true)=>{
|
|
322
|
-
if (0 === tasks.length) return utils
|
|
323
|
+
if (0 === tasks.length) return utils.yW.dim(`no ${name}`);
|
|
323
324
|
const passed = tasks.filter((result)=>'pass' === result.status);
|
|
324
325
|
const failed = tasks.filter((result)=>'fail' === result.status);
|
|
325
326
|
const skipped = tasks.filter((result)=>'skip' === result.status);
|
|
326
327
|
const todo = tasks.filter((result)=>'todo' === result.status);
|
|
327
328
|
const status = [
|
|
328
|
-
failed.length ? utils
|
|
329
|
-
passed.length ? utils
|
|
330
|
-
skipped.length ? utils
|
|
331
|
-
todo.length ? utils
|
|
329
|
+
failed.length ? utils.yW.bold(utils.yW.red(`${failed.length} failed`)) : null,
|
|
330
|
+
passed.length ? utils.yW.bold(utils.yW.green(`${passed.length} passed`)) : null,
|
|
331
|
+
skipped.length ? utils.yW.yellow(`${skipped.length} skipped`) : null,
|
|
332
|
+
todo.length ? utils.yW.gray(`${todo.length} todo`) : null
|
|
332
333
|
].filter(Boolean);
|
|
333
|
-
return status.join(utils
|
|
334
|
+
return status.join(utils.yW.dim(' | ')) + (showTotal && status.length > 1 ? utils.yW.gray(` (${tasks.length})`) : '');
|
|
334
335
|
};
|
|
335
336
|
const printSnapshotSummaryLog = (snapshots, rootDir)=>{
|
|
336
337
|
const summary = [];
|
|
337
|
-
if (snapshots.added) summary.push(utils
|
|
338
|
-
if (snapshots.unmatched) summary.push(utils
|
|
339
|
-
if (snapshots.updated) summary.push(utils
|
|
340
|
-
if (snapshots.filesRemoved) if (snapshots.didUpdate) summary.push(utils
|
|
341
|
-
else summary.push(utils
|
|
338
|
+
if (snapshots.added) summary.push(utils.yW.bold(utils.yW.green(`${snapshots.added} written`)));
|
|
339
|
+
if (snapshots.unmatched) summary.push(utils.yW.bold(utils.yW.red(`${snapshots.unmatched} failed`)));
|
|
340
|
+
if (snapshots.updated) summary.push(utils.yW.bold(utils.yW.green(`${snapshots.updated} updated `)));
|
|
341
|
+
if (snapshots.filesRemoved) if (snapshots.didUpdate) summary.push(utils.yW.bold(utils.yW.green(`${snapshots.filesRemoved} files removed `)));
|
|
342
|
+
else summary.push(utils.yW.bold(utils.yW.yellow(`${snapshots.filesRemoved} files obsolete `)));
|
|
342
343
|
const POINTER = "\u279C";
|
|
343
344
|
if (snapshots.filesRemovedList?.length) {
|
|
344
345
|
const [head, ...tail] = snapshots.filesRemovedList;
|
|
345
|
-
summary.push(`${utils
|
|
346
|
-
for (const key of tail)summary.push(` ${(0, utils.
|
|
346
|
+
summary.push(`${utils.yW.gray(POINTER)} ${(0, utils.XJ)(rootDir, head)}`);
|
|
347
|
+
for (const key of tail)summary.push(` ${(0, utils.XJ)(rootDir, key)}`);
|
|
347
348
|
}
|
|
348
349
|
if (snapshots.unchecked) {
|
|
349
|
-
if (snapshots.didUpdate) summary.push(utils
|
|
350
|
-
else summary.push(utils
|
|
350
|
+
if (snapshots.didUpdate) summary.push(utils.yW.bold(utils.yW.green(`${snapshots.unchecked} removed`)));
|
|
351
|
+
else summary.push(utils.yW.bold(utils.yW.yellow(`${snapshots.unchecked} obsolete`)));
|
|
351
352
|
for (const uncheckedFile of snapshots.uncheckedKeysByFile){
|
|
352
|
-
summary.push(`${utils
|
|
353
|
+
summary.push(`${utils.yW.gray(POINTER)} ${(0, utils.XJ)(rootDir, uncheckedFile.filePath)}`);
|
|
353
354
|
for (const key of uncheckedFile.keys)summary.push(` ${key}`);
|
|
354
355
|
}
|
|
355
356
|
}
|
|
356
357
|
for (const [index, snapshot] of summary.entries()){
|
|
357
358
|
const title = 0 === index ? 'Snapshots' : '';
|
|
358
|
-
utils.
|
|
359
|
+
utils.vF.log(`${utils.yW.gray(title.padStart(12))} ${snapshot}`);
|
|
359
360
|
}
|
|
360
361
|
};
|
|
361
362
|
const printSummaryLog = ({ results, testResults, snapshotSummary, duration, rootPath })=>{
|
|
362
|
-
utils.
|
|
363
|
+
utils.vF.log('');
|
|
363
364
|
printSnapshotSummaryLog(snapshotSummary, rootPath);
|
|
364
|
-
utils.
|
|
365
|
-
utils.
|
|
366
|
-
utils.
|
|
367
|
-
utils.
|
|
365
|
+
utils.vF.log(`${utils.yW.gray('Test Files'.padStart(11))} ${getSummaryStatusString(results)}`);
|
|
366
|
+
utils.vF.log(`${utils.yW.gray('Tests'.padStart(11))} ${getSummaryStatusString(testResults)}`);
|
|
367
|
+
utils.vF.log(`${utils.yW.gray('Duration'.padStart(11))} ${(0, utils.kV)(duration.totalTime)} ${utils.yW.gray(`(build ${(0, utils.kV)(duration.buildTime)}, tests ${(0, utils.kV)(duration.testTime)})`)}`);
|
|
368
|
+
utils.vF.log('');
|
|
368
369
|
};
|
|
369
|
-
const printSummaryErrorLogs = async ({ testResults, results, rootPath, getSourcemap })=>{
|
|
370
|
+
const printSummaryErrorLogs = async ({ testResults, results, rootPath, getSourcemap, filterRerunTestPaths })=>{
|
|
370
371
|
const failedTests = [
|
|
371
|
-
...results.filter((i)=>'fail' === i.status && i.errors?.length),
|
|
372
|
-
...testResults.filter((i)=>'fail' === i.status)
|
|
372
|
+
...results.filter((i)=>'fail' === i.status && i.errors?.length && (filterRerunTestPaths ? filterRerunTestPaths.includes(i.testPath) : true)),
|
|
373
|
+
...testResults.filter((i)=>'fail' === i.status && (filterRerunTestPaths ? filterRerunTestPaths.includes(i.testPath) : true))
|
|
373
374
|
];
|
|
374
375
|
if (0 === failedTests.length) return;
|
|
375
|
-
utils.
|
|
376
|
-
utils.
|
|
377
|
-
utils.
|
|
376
|
+
utils.vF.log('');
|
|
377
|
+
utils.vF.log(utils.yW.bold('Summary of all failing tests:'));
|
|
378
|
+
utils.vF.log('');
|
|
378
379
|
for (const test of failedTests){
|
|
379
380
|
const relativePath = external_pathe_["default"].relative(rootPath, test.testPath);
|
|
380
|
-
const nameStr = (0, utils.
|
|
381
|
-
utils.
|
|
381
|
+
const nameStr = (0, utils.fN)(test);
|
|
382
|
+
utils.vF.log(`${utils.yW.bgRed(' FAIL ')} ${(0, utils.EQ)(relativePath)} ${nameStr.length ? `${utils.yW.dim(utils.vO)} ${nameStr}` : ''}`);
|
|
382
383
|
if (test.errors) {
|
|
383
384
|
const { printError } = await Promise.all([
|
|
384
|
-
__webpack_require__.e("
|
|
385
|
-
__webpack_require__.e("
|
|
385
|
+
__webpack_require__.e("829"),
|
|
386
|
+
__webpack_require__.e("704")
|
|
386
387
|
]).then(__webpack_require__.bind(__webpack_require__, "./src/utils/error.ts"));
|
|
387
388
|
for (const error of test.errors)await printError(error, getSourcemap, rootPath);
|
|
388
389
|
}
|
|
@@ -395,27 +396,27 @@ export const __webpack_modules__ = {
|
|
|
395
396
|
skip: '-'
|
|
396
397
|
};
|
|
397
398
|
const statusColorfulStr = {
|
|
398
|
-
fail: utils
|
|
399
|
-
pass: utils
|
|
400
|
-
todo: utils
|
|
401
|
-
skip: utils
|
|
399
|
+
fail: utils.yW.red(statusStr.fail),
|
|
400
|
+
pass: utils.yW.green(statusStr.pass),
|
|
401
|
+
todo: utils.yW.gray(statusStr.todo),
|
|
402
|
+
skip: utils.yW.gray(statusStr.skip)
|
|
402
403
|
};
|
|
403
404
|
const logCase = (result, slowTestThreshold)=>{
|
|
404
405
|
const isSlowCase = (result.duration || 0) > slowTestThreshold;
|
|
405
|
-
const icon = isSlowCase && 'pass' === result.status ? utils
|
|
406
|
-
const nameStr = (0, utils.
|
|
407
|
-
const duration = void 0 !== result.duration ? ` (${(0, utils.
|
|
408
|
-
const retry = result.retryCount ? utils
|
|
409
|
-
utils.
|
|
410
|
-
if (result.errors) for (const error of result.errors)console.error(utils
|
|
406
|
+
const icon = isSlowCase && 'pass' === result.status ? utils.yW.yellow(statusStr[result.status]) : statusColorfulStr[result.status];
|
|
407
|
+
const nameStr = (0, utils.fN)(result);
|
|
408
|
+
const duration = void 0 !== result.duration ? ` (${(0, utils.kV)(result.duration)})` : '';
|
|
409
|
+
const retry = result.retryCount ? utils.yW.yellow(` (retry x${result.retryCount})`) : '';
|
|
410
|
+
utils.vF.log(` ${icon} ${nameStr}${utils.yW.gray(duration)}${retry}`);
|
|
411
|
+
if (result.errors) for (const error of result.errors)console.error(utils.yW.red(` ${error.message}`));
|
|
411
412
|
};
|
|
412
413
|
const logFileTitle = (test, relativePath, slowTestThreshold, alwaysShowTime = false)=>{
|
|
413
|
-
let title = ` ${utils
|
|
414
|
-
const formatDuration = (duration)=>utils
|
|
415
|
-
title += ` ${utils
|
|
414
|
+
let title = ` ${utils.yW.bold(statusColorfulStr[test.status])} ${(0, utils.EQ)(relativePath)}`;
|
|
415
|
+
const formatDuration = (duration)=>utils.yW[duration > slowTestThreshold ? 'yellow' : 'green']((0, utils.kV)(duration));
|
|
416
|
+
title += ` ${utils.yW.gray(`(${test.results.length})`)}`;
|
|
416
417
|
const isTooSlow = test.duration && test.duration > slowTestThreshold;
|
|
417
418
|
if (alwaysShowTime || isTooSlow) title += ` ${formatDuration(test.duration)}`;
|
|
418
|
-
utils.
|
|
419
|
+
utils.vF.log(title);
|
|
419
420
|
};
|
|
420
421
|
class DefaultReporter {
|
|
421
422
|
rootPath;
|
|
@@ -455,26 +456,27 @@ export const __webpack_modules__ = {
|
|
|
455
456
|
];
|
|
456
457
|
const testPath = (0, external_pathe_.relative)(this.rootPath, log.testPath);
|
|
457
458
|
if (log.trace) {
|
|
458
|
-
const [frame] = (0, stack_trace_parser_esm.
|
|
459
|
+
const [frame] = (0, stack_trace_parser_esm.q)(log.trace);
|
|
459
460
|
const filePath = (0, external_pathe_.relative)(this.rootPath, frame.file || '');
|
|
460
|
-
if (filePath !== testPath) titles.push((0, utils.
|
|
461
|
-
titles.push((0, utils.
|
|
462
|
-
} else titles.push((0, utils.
|
|
463
|
-
utils.
|
|
464
|
-
utils.
|
|
465
|
-
utils.
|
|
461
|
+
if (filePath !== testPath) titles.push((0, utils.EQ)(testPath));
|
|
462
|
+
titles.push((0, utils.EQ)(filePath) + utils.yW.gray(`:${frame.lineNumber}:${frame.column}`));
|
|
463
|
+
} else titles.push((0, utils.EQ)(testPath));
|
|
464
|
+
utils.vF.log(titles.join(utils.yW.gray(' | ')));
|
|
465
|
+
utils.vF.log(log.content);
|
|
466
|
+
utils.vF.log('');
|
|
466
467
|
}
|
|
467
468
|
async onExit() {
|
|
468
469
|
this.statusRenderer?.clear();
|
|
469
470
|
}
|
|
470
|
-
async onTestRunEnd({ results, testResults, duration, getSourcemap, snapshotSummary }) {
|
|
471
|
+
async onTestRunEnd({ results, testResults, duration, getSourcemap, snapshotSummary, filterRerunTestPaths }) {
|
|
471
472
|
this.statusRenderer?.clear();
|
|
472
473
|
if (false === this.options.summary) return;
|
|
473
474
|
await printSummaryErrorLogs({
|
|
474
475
|
testResults,
|
|
475
476
|
results,
|
|
476
477
|
rootPath: this.rootPath,
|
|
477
|
-
getSourcemap
|
|
478
|
+
getSourcemap,
|
|
479
|
+
filterRerunTestPaths
|
|
478
480
|
});
|
|
479
481
|
printSummaryLog({
|
|
480
482
|
results,
|
|
@@ -492,6 +494,9 @@ export const __webpack_modules__ = {
|
|
|
492
494
|
this.onWritePath = options.onWritePath;
|
|
493
495
|
this.rootPath = rootPath;
|
|
494
496
|
}
|
|
497
|
+
log(message) {
|
|
498
|
+
console.log(`${message}\n`);
|
|
499
|
+
}
|
|
495
500
|
async onTestRunEnd({ results, testResults, getSourcemap }) {
|
|
496
501
|
const failedTests = [
|
|
497
502
|
...results.filter((i)=>'fail' === i.status && i.errors?.length),
|
|
@@ -499,14 +504,15 @@ export const __webpack_modules__ = {
|
|
|
499
504
|
];
|
|
500
505
|
if (0 === failedTests.length) return;
|
|
501
506
|
const { parseErrorStacktrace } = await Promise.all([
|
|
502
|
-
__webpack_require__.e("
|
|
503
|
-
__webpack_require__.e("
|
|
507
|
+
__webpack_require__.e("829"),
|
|
508
|
+
__webpack_require__.e("704")
|
|
504
509
|
]).then(__webpack_require__.bind(__webpack_require__, "./src/utils/error.ts"));
|
|
510
|
+
const logs = [];
|
|
505
511
|
for (const test of failedTests){
|
|
506
512
|
const { testPath } = test;
|
|
507
|
-
const nameStr = (0, utils.
|
|
513
|
+
const nameStr = (0, utils.fN)(test);
|
|
508
514
|
const shortPath = (0, external_pathe_.relative)(this.rootPath, testPath);
|
|
509
|
-
const title = `${shortPath} ${utils.
|
|
515
|
+
const title = `${shortPath} ${utils.vO} ${nameStr}`;
|
|
510
516
|
for (const error of test.errors || []){
|
|
511
517
|
let file = testPath;
|
|
512
518
|
let line = 1;
|
|
@@ -525,9 +531,12 @@ export const __webpack_modules__ = {
|
|
|
525
531
|
column = stackFrames[0].column || 1;
|
|
526
532
|
}
|
|
527
533
|
}
|
|
528
|
-
|
|
534
|
+
logs.push(`::${type} file=${this.onWritePath?.(file) || file},line=${line},col=${column},title=${escapeData(title)}::${escapeData(message)}`);
|
|
529
535
|
}
|
|
530
536
|
}
|
|
537
|
+
this.log('::group::error for github actions');
|
|
538
|
+
for (const log of logs)this.log(log);
|
|
539
|
+
this.log('::endgroup::');
|
|
531
540
|
}
|
|
532
541
|
}
|
|
533
542
|
function escapeData(s) {
|
|
@@ -543,13 +552,88 @@ export const __webpack_modules__ = {
|
|
|
543
552
|
}
|
|
544
553
|
}
|
|
545
554
|
var helper = __webpack_require__("./src/utils/helper.ts");
|
|
555
|
+
function formatEnvironmentName(name) {
|
|
556
|
+
return name.replace(/[^a-zA-Z0-9\-_$]/g, '_');
|
|
557
|
+
}
|
|
558
|
+
class Rstest {
|
|
559
|
+
cwd;
|
|
560
|
+
command;
|
|
561
|
+
fileFilters;
|
|
562
|
+
configFilePath;
|
|
563
|
+
reporters;
|
|
564
|
+
snapshotManager;
|
|
565
|
+
version;
|
|
566
|
+
rootPath;
|
|
567
|
+
originalConfig;
|
|
568
|
+
normalizedConfig;
|
|
569
|
+
idMap = new Map();
|
|
570
|
+
reporterResults = {
|
|
571
|
+
results: [],
|
|
572
|
+
testResults: []
|
|
573
|
+
};
|
|
574
|
+
projects = [];
|
|
575
|
+
constructor({ cwd = process.cwd(), command, fileFilters, configFilePath, projects }, userConfig){
|
|
576
|
+
this.cwd = cwd;
|
|
577
|
+
this.command = command;
|
|
578
|
+
this.fileFilters = fileFilters;
|
|
579
|
+
this.configFilePath = configFilePath;
|
|
580
|
+
const rootPath = userConfig.root ? (0, helper.FI)(cwd, userConfig.root) : cwd;
|
|
581
|
+
const rstestConfig = (0, src_config.wX)(userConfig);
|
|
582
|
+
const reporters = 'list' !== command ? createReporters(rstestConfig.reporters, {
|
|
583
|
+
rootPath,
|
|
584
|
+
config: rstestConfig
|
|
585
|
+
}) : [];
|
|
586
|
+
const snapshotManager = new SnapshotManager({
|
|
587
|
+
updateSnapshot: rstestConfig.update ? 'all' : external_std_env_.isCI ? 'none' : 'new'
|
|
588
|
+
});
|
|
589
|
+
this.reporters = reporters;
|
|
590
|
+
this.snapshotManager = snapshotManager;
|
|
591
|
+
this.version = "0.3.0";
|
|
592
|
+
this.rootPath = rootPath;
|
|
593
|
+
this.originalConfig = userConfig;
|
|
594
|
+
this.normalizedConfig = rstestConfig;
|
|
595
|
+
this.projects = projects.length ? projects.map((project)=>{
|
|
596
|
+
const config = (0, src_config.wX)(project.config);
|
|
597
|
+
return {
|
|
598
|
+
configFilePath: project.configFilePath,
|
|
599
|
+
rootPath: config.root,
|
|
600
|
+
name: config.name,
|
|
601
|
+
environmentName: formatEnvironmentName(config.name),
|
|
602
|
+
normalizedConfig: config
|
|
603
|
+
};
|
|
604
|
+
}) : [
|
|
605
|
+
{
|
|
606
|
+
configFilePath,
|
|
607
|
+
rootPath,
|
|
608
|
+
name: rstestConfig.name,
|
|
609
|
+
environmentName: formatEnvironmentName(rstestConfig.name),
|
|
610
|
+
normalizedConfig: rstestConfig
|
|
611
|
+
}
|
|
612
|
+
];
|
|
613
|
+
}
|
|
614
|
+
updateReporterResultState(results, testResults, deletedEntries = []) {
|
|
615
|
+
results.forEach((item)=>{
|
|
616
|
+
const existingIndex = this.reporterResults.results.findIndex((r)=>r.testPath === item.testPath);
|
|
617
|
+
if (-1 !== existingIndex) this.reporterResults.results[existingIndex] = item;
|
|
618
|
+
else this.reporterResults.results.push(item);
|
|
619
|
+
});
|
|
620
|
+
const testPathsToUpdate = new Set(testResults.map((r)=>r.testPath));
|
|
621
|
+
this.reporterResults.testResults = this.reporterResults.testResults.filter((r)=>!testPathsToUpdate.has(r.testPath));
|
|
622
|
+
this.reporterResults.testResults.push(...testResults);
|
|
623
|
+
if (deletedEntries.length > 0) {
|
|
624
|
+
const deletedPathsSet = new Set(deletedEntries);
|
|
625
|
+
this.reporterResults.results = this.reporterResults.results.filter((r)=>!deletedPathsSet.has(r.testPath));
|
|
626
|
+
this.reporterResults.testResults = this.reporterResults.testResults.filter((r)=>!deletedPathsSet.has(r.testPath));
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
546
630
|
const reportersMap = {
|
|
547
631
|
default: DefaultReporter,
|
|
548
632
|
verbose: VerboseReporter,
|
|
549
633
|
'github-actions': GithubActionsReporter
|
|
550
634
|
};
|
|
551
635
|
function createReporters(reporters, initOptions = {}) {
|
|
552
|
-
const result = (0, helper.
|
|
636
|
+
const result = (0, helper.bg)(reporters).map((reporter)=>{
|
|
553
637
|
if ('string' == typeof reporter || Array.isArray(reporter)) {
|
|
554
638
|
const [name, options = {}] = 'string' == typeof reporter ? [
|
|
555
639
|
reporter,
|
|
@@ -568,47 +652,25 @@ export const __webpack_modules__ = {
|
|
|
568
652
|
});
|
|
569
653
|
return result;
|
|
570
654
|
}
|
|
571
|
-
function
|
|
572
|
-
const
|
|
573
|
-
const rootPath = userConfig.root ? (0, helper.ZY)(cwd, userConfig.root) : cwd;
|
|
574
|
-
const rstestConfig = (0, src_config.hY)(userConfig);
|
|
575
|
-
const reporters = 'list' !== command ? createReporters(rstestConfig.reporters, {
|
|
576
|
-
rootPath,
|
|
577
|
-
config: rstestConfig
|
|
578
|
-
}) : [];
|
|
579
|
-
const snapshotManager = new SnapshotManager({
|
|
580
|
-
updateSnapshot: rstestConfig.update ? 'all' : external_std_env_.isCI ? 'none' : 'new'
|
|
581
|
-
});
|
|
582
|
-
return {
|
|
583
|
-
configFilePath,
|
|
584
|
-
command,
|
|
585
|
-
version: "0.2.1",
|
|
586
|
-
rootPath,
|
|
587
|
-
reporters,
|
|
588
|
-
fileFilters,
|
|
589
|
-
snapshotManager,
|
|
590
|
-
originalConfig: userConfig,
|
|
591
|
-
normalizedConfig: rstestConfig
|
|
592
|
-
};
|
|
593
|
-
}
|
|
594
|
-
function createRstest({ config, configFilePath }, command, fileFilters) {
|
|
595
|
-
const context = createContext({
|
|
655
|
+
function createRstest({ config, projects, configFilePath }, command, fileFilters) {
|
|
656
|
+
const context = new Rstest({
|
|
596
657
|
cwd: process.cwd(),
|
|
597
658
|
command,
|
|
598
659
|
fileFilters,
|
|
599
|
-
configFilePath
|
|
660
|
+
configFilePath,
|
|
661
|
+
projects
|
|
600
662
|
}, config);
|
|
601
663
|
const runTests = async ()=>{
|
|
602
664
|
const { runTests } = await Promise.all([
|
|
603
|
-
__webpack_require__.e("
|
|
604
|
-
__webpack_require__.e("
|
|
665
|
+
__webpack_require__.e("985"),
|
|
666
|
+
__webpack_require__.e("33")
|
|
605
667
|
]).then(__webpack_require__.bind(__webpack_require__, "./src/core/runTests.ts"));
|
|
606
668
|
await runTests(context);
|
|
607
669
|
};
|
|
608
670
|
const listTests = async (options)=>{
|
|
609
671
|
const { listTests } = await Promise.all([
|
|
610
|
-
__webpack_require__.e("
|
|
611
|
-
__webpack_require__.e("
|
|
672
|
+
__webpack_require__.e("985"),
|
|
673
|
+
__webpack_require__.e("971")
|
|
612
674
|
]).then(__webpack_require__.bind(__webpack_require__, "./src/core/listTests.ts"));
|
|
613
675
|
await listTests(context, options);
|
|
614
676
|
};
|
package/dist/{72.js → 171.js}
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
export const __webpack_id__ = "171";
|
|
3
4
|
export const __webpack_ids__ = [
|
|
4
|
-
"
|
|
5
|
+
"171"
|
|
5
6
|
];
|
|
6
7
|
export const __webpack_modules__ = {
|
|
7
8
|
"../../node_modules/.pnpm/js-tokens@4.0.0/node_modules/js-tokens/index.js": function(__unused_webpack_module, exports) {
|
package/dist/223.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
export const __webpack_id__ = "223";
|
|
4
|
+
export const __webpack_ids__ = [
|
|
5
|
+
"223"
|
|
6
|
+
];
|
|
7
|
+
export const __webpack_modules__ = {
|
|
8
|
+
"./src/cli/init.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
9
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
10
|
+
initCli: ()=>initCli
|
|
11
|
+
});
|
|
12
|
+
var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:fs");
|
|
13
|
+
var pathe__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("pathe");
|
|
14
|
+
var tinyglobby__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/tinyglobby@0.2.14/node_modules/tinyglobby/dist/index.mjs");
|
|
15
|
+
var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./src/config.ts");
|
|
16
|
+
var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/utils/index.ts");
|
|
17
|
+
async function resolveConfig(options) {
|
|
18
|
+
const { content: config, filePath: configFilePath } = await (0, _config__WEBPACK_IMPORTED_MODULE_2__.Z9)({
|
|
19
|
+
cwd: options.root,
|
|
20
|
+
path: options.config,
|
|
21
|
+
configLoader: options.configLoader
|
|
22
|
+
});
|
|
23
|
+
const keys = [
|
|
24
|
+
'root',
|
|
25
|
+
'globals',
|
|
26
|
+
'isolate',
|
|
27
|
+
'passWithNoTests',
|
|
28
|
+
'update',
|
|
29
|
+
'testNamePattern',
|
|
30
|
+
'testTimeout',
|
|
31
|
+
'hookTimeout',
|
|
32
|
+
'clearMocks',
|
|
33
|
+
'resetMocks',
|
|
34
|
+
'restoreMocks',
|
|
35
|
+
'unstubEnvs',
|
|
36
|
+
'unstubGlobals',
|
|
37
|
+
'retry',
|
|
38
|
+
'slowTestThreshold',
|
|
39
|
+
'maxConcurrency',
|
|
40
|
+
'printConsoleTrace',
|
|
41
|
+
'disableConsoleIntercept',
|
|
42
|
+
'testEnvironment'
|
|
43
|
+
];
|
|
44
|
+
for (const key of keys)if (void 0 !== options[key]) config[key] = options[key];
|
|
45
|
+
if (options.reporter) config.reporters = (0, _utils__WEBPACK_IMPORTED_MODULE_3__.bg)(options.reporter);
|
|
46
|
+
if (options.exclude) config.exclude = (0, _utils__WEBPACK_IMPORTED_MODULE_3__.bg)(options.exclude);
|
|
47
|
+
if (options.include) config.include = (0, _utils__WEBPACK_IMPORTED_MODULE_3__.bg)(options.include);
|
|
48
|
+
return {
|
|
49
|
+
config,
|
|
50
|
+
configFilePath: configFilePath ?? void 0
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
async function resolveProjects({ config, root, options }) {
|
|
54
|
+
if (!config.projects || !config.projects.length) return [];
|
|
55
|
+
const getDefaultProjectName = (dir)=>{
|
|
56
|
+
const pkgJsonPath = (0, pathe__WEBPACK_IMPORTED_MODULE_1__.resolve)(dir, 'package.json');
|
|
57
|
+
const name = (0, node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync)(pkgJsonPath) ? JSON.parse((0, node_fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync)(pkgJsonPath, 'utf-8')).name : '';
|
|
58
|
+
if ('string' != typeof name || !name) return (0, pathe__WEBPACK_IMPORTED_MODULE_1__.basename)(dir);
|
|
59
|
+
return name;
|
|
60
|
+
};
|
|
61
|
+
const globProjects = async (patterns)=>{
|
|
62
|
+
const globOptions = {
|
|
63
|
+
absolute: true,
|
|
64
|
+
dot: true,
|
|
65
|
+
onlyFiles: false,
|
|
66
|
+
cwd: root,
|
|
67
|
+
expandDirectories: false,
|
|
68
|
+
ignore: [
|
|
69
|
+
'**/node_modules/**',
|
|
70
|
+
'**/.DS_Store'
|
|
71
|
+
]
|
|
72
|
+
};
|
|
73
|
+
return (0, tinyglobby__WEBPACK_IMPORTED_MODULE_4__.glob)(patterns, globOptions);
|
|
74
|
+
};
|
|
75
|
+
const { projectPaths, projectPatterns } = (config.projects || []).reduce((total, p)=>{
|
|
76
|
+
const projectStr = p.replace('<rootDir>', root);
|
|
77
|
+
if ((0, tinyglobby__WEBPACK_IMPORTED_MODULE_4__.ey)(projectStr)) total.projectPatterns.push(projectStr);
|
|
78
|
+
else {
|
|
79
|
+
const absolutePath = (0, _utils__WEBPACK_IMPORTED_MODULE_3__.FI)(root, projectStr);
|
|
80
|
+
if (!(0, node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync)(absolutePath)) throw `Can't resolve project "${p}", please make sure "${p}" is a existing file or a directory.`;
|
|
81
|
+
total.projectPaths.push(absolutePath);
|
|
82
|
+
}
|
|
83
|
+
return total;
|
|
84
|
+
}, {
|
|
85
|
+
projectPaths: [],
|
|
86
|
+
projectPatterns: []
|
|
87
|
+
});
|
|
88
|
+
projectPaths.push(...await globProjects(projectPatterns));
|
|
89
|
+
const projects = await Promise.all(projectPaths.map(async (project)=>{
|
|
90
|
+
const isDirectory = (0, node_fs__WEBPACK_IMPORTED_MODULE_0__.statSync)(project).isDirectory();
|
|
91
|
+
const { config, configFilePath } = await resolveConfig({
|
|
92
|
+
...options,
|
|
93
|
+
config: isDirectory ? void 0 : project,
|
|
94
|
+
root: isDirectory ? project : (0, pathe__WEBPACK_IMPORTED_MODULE_1__.dirname)(project)
|
|
95
|
+
});
|
|
96
|
+
config.name ??= getDefaultProjectName(project);
|
|
97
|
+
if (config.projects?.length && config.root !== root) _utils__WEBPACK_IMPORTED_MODULE_3__.vF.warn(`Projects cannot have nested projects, the "projects" field in project "${config.name}" will be ignored.`);
|
|
98
|
+
return {
|
|
99
|
+
config,
|
|
100
|
+
configFilePath
|
|
101
|
+
};
|
|
102
|
+
}));
|
|
103
|
+
const names = new Set();
|
|
104
|
+
projects.forEach((project)=>{
|
|
105
|
+
if (names.has(project.config.name)) {
|
|
106
|
+
const conflictProjects = projects.filter((p)=>p.config.name === project.config.name);
|
|
107
|
+
throw `Project name "${project.config.name}" is already used. Please ensure all projects have unique names.
|
|
108
|
+
Conflicting projects:
|
|
109
|
+
${conflictProjects.map((p)=>`- ${p.configFilePath || p.config.root}`).join('\n')}
|
|
110
|
+
`;
|
|
111
|
+
}
|
|
112
|
+
names.add(project.config.name);
|
|
113
|
+
});
|
|
114
|
+
return projects;
|
|
115
|
+
}
|
|
116
|
+
async function initCli(options) {
|
|
117
|
+
const cwd = process.cwd();
|
|
118
|
+
const root = options.root ? (0, _utils__WEBPACK_IMPORTED_MODULE_3__.FI)(cwd, options.root) : cwd;
|
|
119
|
+
const { config, configFilePath } = await resolveConfig({
|
|
120
|
+
...options,
|
|
121
|
+
root
|
|
122
|
+
});
|
|
123
|
+
const projects = await resolveProjects({
|
|
124
|
+
config,
|
|
125
|
+
root,
|
|
126
|
+
options
|
|
127
|
+
});
|
|
128
|
+
return {
|
|
129
|
+
config,
|
|
130
|
+
configFilePath,
|
|
131
|
+
projects
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
};
|