@rstest/core 0.9.4 → 0.9.5
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 +0 -228
- package/dist/0~8843.js +23 -13
- package/dist/0~browserLoader.js +1 -1
- package/dist/0~browser~1.js +4 -4
- package/dist/0~checkThresholds.js +1 -1
- package/dist/0~console.js +1 -1
- package/dist/0~fake-timers.js +1483 -0
- package/dist/0~generate.js +4 -3
- package/dist/0~happyDom.js +1 -1
- package/dist/0~jsdom.js +1 -1
- package/dist/0~listTests.js +3 -3
- package/dist/0~loadModule.js +1 -1
- package/dist/0~runTests.js +11 -4
- package/dist/0~snapshot.js +2140 -0
- package/dist/0~snapshot.js.LICENSE.txt +7 -0
- package/dist/0~utils.js +1 -1
- package/dist/1949.js +2919 -9808
- package/dist/1949.js.LICENSE.txt +1 -49
- package/dist/3145.js +318 -36
- package/dist/4411.js +232 -47
- package/dist/6830.js +61 -9
- package/dist/7552.js +22 -4918
- package/dist/9743.js +1982 -0
- package/dist/9784.js +1343 -0
- package/dist/{7552.js.LICENSE.txt → 9784.js.LICENSE.txt} +19 -8
- package/dist/browser-runtime/2~fake-timers.js +1653 -0
- package/dist/browser-runtime/2~snapshot.js +2138 -0
- package/dist/browser-runtime/2~snapshot.js.LICENSE.txt +7 -0
- package/dist/browser-runtime/723.js +2055 -10605
- package/dist/browser-runtime/723.js.LICENSE.txt +0 -17
- package/dist/browser-runtime/index.d.ts +189 -11
- package/dist/browser-runtime/rslib-runtime.js +0 -7
- package/dist/browser.d.ts +39 -5
- package/dist/browser.js +2 -2
- package/dist/globalSetupWorker.js +1 -1
- package/dist/index.d.ts +39 -5
- package/dist/mockRuntimeCode.js +2 -0
- package/dist/worker.d.ts +31 -5
- package/dist/worker.js +11 -9
- package/package.json +21 -22
package/dist/1949.js.LICENSE.txt
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @version 1.4.0
|
|
3
|
-
* @date 2015-10-26
|
|
4
|
-
* @stability 3 - Stable
|
|
5
|
-
* @author Lauri Rooden (https://github.com/litejs/natural-compare-lite)
|
|
6
|
-
* @license MIT License
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
1
|
/*!
|
|
10
2
|
* Chai - addChainingMethod utility
|
|
11
3
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -268,44 +260,4 @@ deep-eql/index.js:
|
|
|
268
260
|
* @param {Mixed} value
|
|
269
261
|
* @return {Boolean} result
|
|
270
262
|
*)
|
|
271
|
-
*/
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* @license React
|
|
275
|
-
* react-is.development.js
|
|
276
|
-
*
|
|
277
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
278
|
-
*
|
|
279
|
-
* This source code is licensed under the MIT license found in the
|
|
280
|
-
* LICENSE file in the root directory of this source tree.
|
|
281
|
-
*/
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* @license React
|
|
285
|
-
* react-is.development.js
|
|
286
|
-
*
|
|
287
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
288
|
-
*
|
|
289
|
-
* This source code is licensed under the MIT license found in the
|
|
290
|
-
* LICENSE file in the root directory of this source tree.
|
|
291
|
-
*/
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* @license React
|
|
295
|
-
* react-is.production.js
|
|
296
|
-
*
|
|
297
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
298
|
-
*
|
|
299
|
-
* This source code is licensed under the MIT license found in the
|
|
300
|
-
* LICENSE file in the root directory of this source tree.
|
|
301
|
-
*/
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* @license React
|
|
305
|
-
* react-is.production.min.js
|
|
306
|
-
*
|
|
307
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
308
|
-
*
|
|
309
|
-
* This source code is licensed under the MIT license found in the
|
|
310
|
-
* LICENSE file in the root directory of this source tree.
|
|
311
|
-
*/
|
|
263
|
+
*/
|
package/dist/3145.js
CHANGED
|
@@ -7,8 +7,8 @@ import promises from "node:fs/promises";
|
|
|
7
7
|
import node_path, { dirname as external_node_path_dirname, resolve as external_node_path_resolve } from "node:path";
|
|
8
8
|
import { createRequire } from "node:module";
|
|
9
9
|
import node_process from "node:process";
|
|
10
|
-
import {
|
|
11
|
-
import { isDynamicPattern, glob,
|
|
10
|
+
import { POINTER, DEFAULT_CONFIG_NAME, globalApis, resolve as pathe_M_eThtNZ_resolve, relative, join, logger as logger_logger, prettyTime, getTempRstestOutputDirGlob, color as logger_color, isAbsolute, getOutputDistPathRoot, TEMP_RSTEST_OUTPUT_DIR, TS_CONFIG_FILE, basename, isTTY, dirname as pathe_M_eThtNZ_dirname, TEST_DELIMITER, getAbsolutePath, bgColor, formatRootStr, determineAgent, castArray, dist_m, getTaskNameWithPrefix, isDebug, formatError, normalize, DEFAULT_CONFIG_EXTENSIONS } from "./6830.js";
|
|
11
|
+
import { isDynamicPattern, glob, filterProjects, prettyTestPath, formatTestPath } from "./4411.js";
|
|
12
12
|
import { posix } from "./7011.js";
|
|
13
13
|
import { parse as stack_trace_parser_esm_parse } from "./1672.js";
|
|
14
14
|
import { decode } from "./4397.js";
|
|
@@ -22,8 +22,7 @@ __webpack_require__.d(init_namespaceObject, {
|
|
|
22
22
|
var core_namespaceObject = {};
|
|
23
23
|
__webpack_require__.r(core_namespaceObject);
|
|
24
24
|
__webpack_require__.d(core_namespaceObject, {
|
|
25
|
-
createRstest: ()=>core_createRstest
|
|
26
|
-
initCli: ()=>init_initCli
|
|
25
|
+
createRstest: ()=>core_createRstest
|
|
27
26
|
});
|
|
28
27
|
var error_namespaceObject = {};
|
|
29
28
|
__webpack_require__.r(error_namespaceObject);
|
|
@@ -589,15 +588,255 @@ function prepareCli() {
|
|
|
589
588
|
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) logger_logger.log();
|
|
590
589
|
}
|
|
591
590
|
function showRstest() {
|
|
592
|
-
logger_logger.greet(" Rstest v0.9.
|
|
591
|
+
logger_logger.greet(" Rstest v0.9.5");
|
|
593
592
|
logger_logger.log('');
|
|
594
593
|
}
|
|
595
|
-
const
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
594
|
+
const runtimeOptionDefinitions = [
|
|
595
|
+
[
|
|
596
|
+
'-c, --config <config>',
|
|
597
|
+
'Specify the configuration file, can be a relative or absolute path'
|
|
598
|
+
],
|
|
599
|
+
[
|
|
600
|
+
'--config-loader <loader>',
|
|
601
|
+
'Specify the loader to load the config file (auto | jiti | native)',
|
|
602
|
+
{
|
|
603
|
+
default: 'auto'
|
|
604
|
+
}
|
|
605
|
+
],
|
|
606
|
+
[
|
|
607
|
+
'-r, --root <root>',
|
|
608
|
+
'Specify the project root directory, can be an absolute path or a path relative to cwd'
|
|
609
|
+
],
|
|
610
|
+
[
|
|
611
|
+
'--globals',
|
|
612
|
+
'Provide global APIs'
|
|
613
|
+
],
|
|
614
|
+
[
|
|
615
|
+
'--isolate',
|
|
616
|
+
'Run tests in an isolated environment'
|
|
617
|
+
],
|
|
618
|
+
[
|
|
619
|
+
'--include <include>',
|
|
620
|
+
'Match test files'
|
|
621
|
+
],
|
|
622
|
+
[
|
|
623
|
+
'--exclude <exclude>',
|
|
624
|
+
'Exclude files from test'
|
|
625
|
+
],
|
|
626
|
+
[
|
|
627
|
+
'-u, --update',
|
|
628
|
+
'Update snapshot files'
|
|
629
|
+
],
|
|
630
|
+
[
|
|
631
|
+
'--coverage',
|
|
632
|
+
'Enable code coverage collection'
|
|
633
|
+
],
|
|
634
|
+
[
|
|
635
|
+
'--project <name>',
|
|
636
|
+
'Run only projects that match the name, can be a full name or wildcards pattern'
|
|
637
|
+
],
|
|
638
|
+
[
|
|
639
|
+
'--passWithNoTests',
|
|
640
|
+
'Allows the test suite to pass when no files are found'
|
|
641
|
+
],
|
|
642
|
+
[
|
|
643
|
+
'--printConsoleTrace',
|
|
644
|
+
'Print console traces when calling any console method'
|
|
645
|
+
],
|
|
646
|
+
[
|
|
647
|
+
'--disableConsoleIntercept',
|
|
648
|
+
'Disable console intercept'
|
|
649
|
+
],
|
|
650
|
+
[
|
|
651
|
+
'--logHeapUsage',
|
|
652
|
+
'Log heap usage after each test'
|
|
653
|
+
],
|
|
654
|
+
[
|
|
655
|
+
'--slowTestThreshold <value>',
|
|
656
|
+
'The number of milliseconds after which a test or suite is considered slow'
|
|
657
|
+
],
|
|
658
|
+
[
|
|
659
|
+
'--reporter <reporter>',
|
|
660
|
+
'Specify the reporter to use'
|
|
661
|
+
],
|
|
662
|
+
[
|
|
663
|
+
'-t, --testNamePattern <value>',
|
|
664
|
+
'Run only tests with a name that matches the regex'
|
|
665
|
+
],
|
|
666
|
+
[
|
|
667
|
+
'--testEnvironment <name>',
|
|
668
|
+
'The environment that will be used for testing'
|
|
669
|
+
],
|
|
670
|
+
[
|
|
671
|
+
'--testTimeout <value>',
|
|
672
|
+
'Timeout of a test in milliseconds'
|
|
673
|
+
],
|
|
674
|
+
[
|
|
675
|
+
'--hookTimeout <value>',
|
|
676
|
+
'Timeout of hook in milliseconds'
|
|
677
|
+
],
|
|
678
|
+
[
|
|
679
|
+
'--hideSkippedTests',
|
|
680
|
+
'Hide skipped tests from the output'
|
|
681
|
+
],
|
|
682
|
+
[
|
|
683
|
+
'--hideSkippedTestFiles',
|
|
684
|
+
'Hide skipped test files from the output'
|
|
685
|
+
],
|
|
686
|
+
[
|
|
687
|
+
'--retry <retry>',
|
|
688
|
+
'Number of times to retry a test if it fails'
|
|
689
|
+
],
|
|
690
|
+
[
|
|
691
|
+
'--bail [number]',
|
|
692
|
+
'Stop running tests after n failures. Set to 0 to run all tests regardless of failures'
|
|
693
|
+
],
|
|
694
|
+
[
|
|
695
|
+
'--shard <index/count>',
|
|
696
|
+
'Split tests into several shards. This is useful for running tests in parallel on multiple machines.'
|
|
697
|
+
],
|
|
698
|
+
[
|
|
699
|
+
'--maxConcurrency <value>',
|
|
700
|
+
'Maximum number of concurrent tests'
|
|
701
|
+
],
|
|
702
|
+
[
|
|
703
|
+
'--clearMocks',
|
|
704
|
+
'Automatically clear mock calls, instances, contexts and results before every test'
|
|
705
|
+
],
|
|
706
|
+
[
|
|
707
|
+
'--resetMocks',
|
|
708
|
+
'Automatically reset mock state before every test'
|
|
709
|
+
],
|
|
710
|
+
[
|
|
711
|
+
'--restoreMocks',
|
|
712
|
+
'Automatically restore mock state and implementation before every test'
|
|
713
|
+
],
|
|
714
|
+
[
|
|
715
|
+
'--browser',
|
|
716
|
+
'Run tests in browser mode'
|
|
717
|
+
],
|
|
718
|
+
[
|
|
719
|
+
'--browser.enabled',
|
|
720
|
+
'Run tests in browser mode'
|
|
721
|
+
],
|
|
722
|
+
[
|
|
723
|
+
'--browser.name <name>',
|
|
724
|
+
'Browser to use: chromium, firefox, webkit (default: chromium)'
|
|
725
|
+
],
|
|
726
|
+
[
|
|
727
|
+
'--browser.headless',
|
|
728
|
+
'Run browser in headless mode (default: true in CI)'
|
|
729
|
+
],
|
|
730
|
+
[
|
|
731
|
+
'--browser.port <port>',
|
|
732
|
+
'Port for the browser mode dev server'
|
|
733
|
+
],
|
|
734
|
+
[
|
|
735
|
+
'--browser.strictPort',
|
|
736
|
+
'Exit if the specified port is already in use'
|
|
737
|
+
],
|
|
738
|
+
[
|
|
739
|
+
'--unstubGlobals',
|
|
740
|
+
'Restores all global variables that were changed with `rstest.stubGlobal` before every test'
|
|
741
|
+
],
|
|
742
|
+
[
|
|
743
|
+
'--unstubEnvs',
|
|
744
|
+
'Restores all runtime env values that were changed with `rstest.stubEnv` before every test'
|
|
745
|
+
],
|
|
746
|
+
[
|
|
747
|
+
'--includeTaskLocation',
|
|
748
|
+
'Collect test and suite locations. This might increase the running time.'
|
|
749
|
+
]
|
|
750
|
+
];
|
|
751
|
+
const poolOptionDefinitions = [
|
|
752
|
+
[
|
|
753
|
+
'--pool <type>',
|
|
754
|
+
'Shorthand for --pool.type'
|
|
755
|
+
],
|
|
756
|
+
[
|
|
757
|
+
'--pool.type <type>',
|
|
758
|
+
'Specify the test pool type (e.g. forks)'
|
|
759
|
+
],
|
|
760
|
+
[
|
|
761
|
+
'--pool.maxWorkers <value>',
|
|
762
|
+
'Maximum number or percentage of workers (e.g. 4 or 50%)'
|
|
763
|
+
],
|
|
764
|
+
[
|
|
765
|
+
'--pool.minWorkers <value>',
|
|
766
|
+
'Minimum number or percentage of workers (e.g. 1 or 25%)'
|
|
767
|
+
],
|
|
768
|
+
[
|
|
769
|
+
'--pool.execArgv <arg>',
|
|
770
|
+
'Additional Node.js execArgv passed to worker processes (can be specified multiple times)'
|
|
771
|
+
]
|
|
772
|
+
];
|
|
773
|
+
const mergeReportsOptionDefinitions = [
|
|
774
|
+
[
|
|
775
|
+
'-c, --config <config>',
|
|
776
|
+
'Specify the configuration file, can be a relative or absolute path'
|
|
777
|
+
],
|
|
778
|
+
[
|
|
779
|
+
'--config-loader <loader>',
|
|
780
|
+
'Specify the loader to load the config file (auto | jiti | native)',
|
|
781
|
+
{
|
|
782
|
+
default: 'auto'
|
|
783
|
+
}
|
|
784
|
+
],
|
|
785
|
+
[
|
|
786
|
+
'-r, --root <root>',
|
|
787
|
+
'Specify the project root directory, can be an absolute path or a path relative to cwd'
|
|
788
|
+
],
|
|
789
|
+
[
|
|
790
|
+
'--coverage',
|
|
791
|
+
'Enable code coverage collection'
|
|
792
|
+
],
|
|
793
|
+
[
|
|
794
|
+
'--reporter <reporter>',
|
|
795
|
+
'Specify the reporter to use'
|
|
796
|
+
],
|
|
797
|
+
[
|
|
798
|
+
'--cleanup',
|
|
799
|
+
'Remove blob reports directory after merging'
|
|
800
|
+
]
|
|
801
|
+
];
|
|
802
|
+
const hiddenPassthroughOptionDefinitions = [
|
|
803
|
+
[
|
|
804
|
+
'--isolate',
|
|
805
|
+
'Run tests in an isolated environment'
|
|
806
|
+
]
|
|
807
|
+
];
|
|
808
|
+
const listCommandOptionDefinitions = [
|
|
809
|
+
[
|
|
810
|
+
'--filesOnly',
|
|
811
|
+
'only list the test files'
|
|
812
|
+
],
|
|
813
|
+
[
|
|
814
|
+
'--json [boolean/path]',
|
|
815
|
+
'print tests as JSON or write to a file'
|
|
816
|
+
],
|
|
817
|
+
[
|
|
818
|
+
'--includeSuites',
|
|
819
|
+
'include suites in output'
|
|
820
|
+
],
|
|
821
|
+
[
|
|
822
|
+
'--printLocation',
|
|
823
|
+
'print test case location'
|
|
824
|
+
]
|
|
825
|
+
];
|
|
826
|
+
const applyOptions = (command, definitions)=>{
|
|
827
|
+
for (const [rawName, description, config] of definitions)command.option(rawName, description, config);
|
|
828
|
+
};
|
|
829
|
+
const applyRuntimeCommandOptions = (command)=>{
|
|
830
|
+
applyOptions(command, runtimeOptionDefinitions);
|
|
831
|
+
applyOptions(command, poolOptionDefinitions);
|
|
600
832
|
};
|
|
833
|
+
const filterHelpOptions = (sections, hiddenOptionPrefixes)=>sections.map((section)=>{
|
|
834
|
+
if ('Options' !== section.title) return section;
|
|
835
|
+
return {
|
|
836
|
+
...section,
|
|
837
|
+
body: section.body.split('\n').filter((line)=>!hiddenOptionPrefixes.some((prefix)=>line.trimStart().startsWith(prefix))).join('\n')
|
|
838
|
+
};
|
|
839
|
+
});
|
|
601
840
|
const handleUnexpectedExit = (rstest, err)=>{
|
|
602
841
|
for (const reporter of rstest?.context.reporters || [])reporter.onExit?.();
|
|
603
842
|
logger_logger.error('Failed to run Rstest.');
|
|
@@ -648,12 +887,23 @@ const runRest = async ({ options, filters, command })=>{
|
|
|
648
887
|
handleUnexpectedExit(rstest, err);
|
|
649
888
|
}
|
|
650
889
|
};
|
|
651
|
-
function
|
|
890
|
+
function createCli() {
|
|
652
891
|
const cli = cac('rstest');
|
|
653
|
-
cli.help()
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
892
|
+
cli.help((sections)=>{
|
|
893
|
+
switch(cli.matchedCommand?.name){
|
|
894
|
+
case 'init':
|
|
895
|
+
case 'merge-reports':
|
|
896
|
+
return filterHelpOptions(sections, [
|
|
897
|
+
'--isolate'
|
|
898
|
+
]);
|
|
899
|
+
default:
|
|
900
|
+
return sections;
|
|
901
|
+
}
|
|
902
|
+
});
|
|
903
|
+
cli.version("0.9.5");
|
|
904
|
+
const defaultCommand = cli.command('[...filters]', 'run tests').option('-w, --watch', 'Run tests in watch mode');
|
|
905
|
+
applyRuntimeCommandOptions(defaultCommand);
|
|
906
|
+
defaultCommand.action(async (filters, options)=>{
|
|
657
907
|
if (!determineAgent().isAgent) showRstest();
|
|
658
908
|
if (options.watch) await runRest({
|
|
659
909
|
options,
|
|
@@ -666,7 +916,9 @@ function setupCommands() {
|
|
|
666
916
|
command: 'run'
|
|
667
917
|
});
|
|
668
918
|
});
|
|
669
|
-
cli.command('run [...filters]', 'run tests without watch mode')
|
|
919
|
+
const runCommand = cli.command('run [...filters]', 'run tests without watch mode');
|
|
920
|
+
applyRuntimeCommandOptions(runCommand);
|
|
921
|
+
runCommand.action(async (filters, options)=>{
|
|
670
922
|
if (!determineAgent().isAgent) showRstest();
|
|
671
923
|
await runRest({
|
|
672
924
|
options,
|
|
@@ -674,7 +926,9 @@ function setupCommands() {
|
|
|
674
926
|
command: 'run'
|
|
675
927
|
});
|
|
676
928
|
});
|
|
677
|
-
cli.command('watch [...filters]', 'run tests in watch mode')
|
|
929
|
+
const watchCommand = cli.command('watch [...filters]', 'run tests in watch mode');
|
|
930
|
+
applyRuntimeCommandOptions(watchCommand);
|
|
931
|
+
watchCommand.action(async (filters, options)=>{
|
|
678
932
|
if (!determineAgent().isAgent) showRstest();
|
|
679
933
|
await runRest({
|
|
680
934
|
options,
|
|
@@ -682,7 +936,10 @@ function setupCommands() {
|
|
|
682
936
|
command: 'watch'
|
|
683
937
|
});
|
|
684
938
|
});
|
|
685
|
-
cli.command('list [...filters]', 'lists all test files that Rstest will run')
|
|
939
|
+
const listCommand = cli.command('list [...filters]', 'lists all test files that Rstest will run');
|
|
940
|
+
applyRuntimeCommandOptions(listCommand);
|
|
941
|
+
applyOptions(listCommand, listCommandOptionDefinitions);
|
|
942
|
+
listCommand.action(async (filters, options)=>{
|
|
686
943
|
try {
|
|
687
944
|
const { config, configFilePath, projects, createRstest } = await resolveCliRuntime(options);
|
|
688
945
|
if (options.printLocation) config.includeTaskLocation = true;
|
|
@@ -703,7 +960,10 @@ function setupCommands() {
|
|
|
703
960
|
process.exit(1);
|
|
704
961
|
}
|
|
705
962
|
});
|
|
706
|
-
cli.command('merge-reports [path]', 'Merge blob reports from multiple shards into a unified report')
|
|
963
|
+
const mergeReportsCommand = cli.command('merge-reports [path]', 'Merge blob reports from multiple shards into a unified report');
|
|
964
|
+
applyOptions(mergeReportsCommand, mergeReportsOptionDefinitions);
|
|
965
|
+
applyOptions(mergeReportsCommand, hiddenPassthroughOptionDefinitions);
|
|
966
|
+
mergeReportsCommand.action(async (path, options)=>{
|
|
707
967
|
if (!determineAgent().isAgent) showRstest();
|
|
708
968
|
try {
|
|
709
969
|
const { config, configFilePath, projects, createRstest } = await resolveCliRuntime(options);
|
|
@@ -722,7 +982,7 @@ function setupCommands() {
|
|
|
722
982
|
process.exit(1);
|
|
723
983
|
}
|
|
724
984
|
});
|
|
725
|
-
cli.command('init [project]', 'Initialize rstest configuration').option('--yes', 'Use default options (non-interactive)').action(async (project, options)=>{
|
|
985
|
+
cli.command('init [project]', 'Initialize rstest configuration').option('--yes', 'Use default options (non-interactive)').option('--isolate', 'Run tests in an isolated environment').action(async (project, options)=>{
|
|
726
986
|
try {
|
|
727
987
|
let selectedProject = project;
|
|
728
988
|
if (!selectedProject) {
|
|
@@ -759,7 +1019,10 @@ function setupCommands() {
|
|
|
759
1019
|
process.exit(1);
|
|
760
1020
|
}
|
|
761
1021
|
});
|
|
762
|
-
cli
|
|
1022
|
+
return cli;
|
|
1023
|
+
}
|
|
1024
|
+
function setupCommands() {
|
|
1025
|
+
createCli().parse();
|
|
763
1026
|
}
|
|
764
1027
|
const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(node_fs.existsSync);
|
|
765
1028
|
const resolveConfigPath = (root, customConfig)=>{
|
|
@@ -861,6 +1124,11 @@ const createDefaultConfig = ()=>({
|
|
|
861
1124
|
testEnvironment: {
|
|
862
1125
|
name: 'node'
|
|
863
1126
|
},
|
|
1127
|
+
output: {
|
|
1128
|
+
distPath: {
|
|
1129
|
+
root: TEMP_RSTEST_OUTPUT_DIR
|
|
1130
|
+
}
|
|
1131
|
+
},
|
|
864
1132
|
retry: 0,
|
|
865
1133
|
reporters: 'true' === process.env.GITHUB_ACTIONS ? [
|
|
866
1134
|
'default',
|
|
@@ -922,7 +1190,11 @@ const withDefaultConfig = (config)=>{
|
|
|
922
1190
|
const merged = mergeRstestConfig(createDefaultConfig(), config);
|
|
923
1191
|
merged.setupFiles = castArray(merged.setupFiles);
|
|
924
1192
|
merged.globalSetup = castArray(merged.globalSetup);
|
|
925
|
-
merged.
|
|
1193
|
+
const outputDistPathRoot = getOutputDistPathRoot(merged.output?.distPath);
|
|
1194
|
+
merged.output.distPath = {
|
|
1195
|
+
root: formatRootStr(outputDistPathRoot, merged.root)
|
|
1196
|
+
};
|
|
1197
|
+
merged.exclude.patterns.push(getTempRstestOutputDirGlob(merged.output?.distPath?.root));
|
|
926
1198
|
const reportsDirectory = formatRootStr(merged.coverage.reportsDirectory, merged.root);
|
|
927
1199
|
merged.coverage.reportsDirectory = isAbsolute(reportsDirectory) ? reportsDirectory : pathe_M_eThtNZ_resolve(merged.root, reportsDirectory);
|
|
928
1200
|
merged.pool = 'string' == typeof config.pool ? {
|
|
@@ -1267,14 +1539,14 @@ const printSnapshotSummaryLog = (snapshots, rootDir)=>{
|
|
|
1267
1539
|
else summary.push(logger_color.bold(logger_color.yellow(`${snapshots.filesRemoved} files obsolete `)));
|
|
1268
1540
|
if (snapshots.filesRemovedList?.length) {
|
|
1269
1541
|
const [head, ...tail] = snapshots.filesRemovedList;
|
|
1270
|
-
summary.push(`${logger_color.gray(
|
|
1542
|
+
summary.push(`${logger_color.gray(POINTER)} ${formatTestPath(rootDir, head)}`);
|
|
1271
1543
|
for (const key of tail)summary.push(` ${formatTestPath(rootDir, key)}`);
|
|
1272
1544
|
}
|
|
1273
1545
|
if (snapshots.unchecked) {
|
|
1274
1546
|
if (snapshots.didUpdate) summary.push(logger_color.bold(logger_color.green(`${snapshots.unchecked} removed`)));
|
|
1275
1547
|
else summary.push(logger_color.bold(logger_color.yellow(`${snapshots.unchecked} obsolete`)));
|
|
1276
1548
|
for (const uncheckedFile of snapshots.uncheckedKeysByFile){
|
|
1277
|
-
summary.push(`${logger_color.gray(
|
|
1549
|
+
summary.push(`${logger_color.gray(POINTER)} ${formatTestPath(rootDir, uncheckedFile.filePath)}`);
|
|
1278
1550
|
for (const key of uncheckedFile.keys)summary.push(` ${key}`);
|
|
1279
1551
|
}
|
|
1280
1552
|
}
|
|
@@ -1311,7 +1583,7 @@ const printSummaryErrorLogs = async ({ testResults, results, rootPath, unhandled
|
|
|
1311
1583
|
for (const test of failedTests){
|
|
1312
1584
|
const relativePath = posix.relative(rootPath, test.testPath);
|
|
1313
1585
|
const nameStr = getTaskNameWithPrefix(test);
|
|
1314
|
-
logger_logger.stderr(`${bgColor('bgRed', ' FAIL ')} ${prettyTestPath(relativePath)} ${nameStr.length ? `${logger_color.dim(
|
|
1586
|
+
logger_logger.stderr(`${bgColor('bgRed', ' FAIL ')} ${prettyTestPath(relativePath)} ${nameStr.length ? `${logger_color.dim(TEST_DELIMITER)} ${nameStr}` : ''}`);
|
|
1315
1587
|
if (test.errors) {
|
|
1316
1588
|
const { printError } = await Promise.resolve(error_namespaceObject);
|
|
1317
1589
|
for (const error of test.errors)await printError(error, getSourcemap, rootPath);
|
|
@@ -1468,7 +1740,7 @@ class StatusRenderer {
|
|
|
1468
1740
|
const relativePath = relative(this.rootPath, module);
|
|
1469
1741
|
summary.push(`${bgColor('bgYellow', ' RUNS ')} ${prettyTestPath(relativePath)}`);
|
|
1470
1742
|
if (runningTests.length && shouldDisplayRunningTests(runningTests)) {
|
|
1471
|
-
let caseLog = ` ${logger_color.gray(
|
|
1743
|
+
let caseLog = ` ${logger_color.gray(POINTER)} ${getTaskNameWithPrefix(runningTests[0])} ${logger_color.magenta(prettyTime(now - runningTests[0].startTime))}`;
|
|
1472
1744
|
if (runningTests.length > 1) caseLog += logger_color.gray(` and ${runningTests.length - 1} more cases`);
|
|
1473
1745
|
summary.push(caseLog);
|
|
1474
1746
|
}
|
|
@@ -1631,7 +1903,7 @@ class BlobReporter {
|
|
|
1631
1903
|
const shard = this.config.shard;
|
|
1632
1904
|
const fileName = shard ? `blob-${shard.index}-${shard.count}.json` : 'blob.json';
|
|
1633
1905
|
const blobData = {
|
|
1634
|
-
version: "0.9.
|
|
1906
|
+
version: "0.9.5",
|
|
1635
1907
|
shard: shard ? {
|
|
1636
1908
|
index: shard.index,
|
|
1637
1909
|
count: shard.count
|
|
@@ -1675,7 +1947,7 @@ class GithubActionsReporter {
|
|
|
1675
1947
|
const { testPath } = test;
|
|
1676
1948
|
const nameStr = getTaskNameWithPrefix(test);
|
|
1677
1949
|
const shortPath = relative(this.rootPath, testPath);
|
|
1678
|
-
const title = `${shortPath}
|
|
1950
|
+
const title = `${shortPath} ${TEST_DELIMITER} ${nameStr}`;
|
|
1679
1951
|
for (const error of test.errors || []){
|
|
1680
1952
|
let file = testPath;
|
|
1681
1953
|
let line = 1;
|
|
@@ -2022,7 +2294,7 @@ function traceSegmentInternal(segments, memo, line, column, bias) {
|
|
|
2022
2294
|
const isRelativePath = (p)=>/^\.\.?\//.test(p);
|
|
2023
2295
|
const isHttpLikeFile = (file)=>/^https?:\/\//.test(file);
|
|
2024
2296
|
const hintNotDefinedError = (message)=>{
|
|
2025
|
-
const [, varName] =
|
|
2297
|
+
const [, varName] = /(\w+) is not defined/.exec(message) || [];
|
|
2026
2298
|
if (varName) {
|
|
2027
2299
|
if (globalApis.includes(varName)) return message.replace(`${varName} is not defined`, `${varName} is not defined. Did you forget to enable "globals" configuration?`);
|
|
2028
2300
|
if ([
|
|
@@ -2101,10 +2373,15 @@ const stackIgnores = [
|
|
|
2101
2373
|
'<anonymous>'
|
|
2102
2374
|
];
|
|
2103
2375
|
async function error_parseErrorStacktrace({ stack, getSourcemap, fullStack = isDebug() }) {
|
|
2376
|
+
const traceMapCache = new Map();
|
|
2104
2377
|
const stackFrames = await Promise.all(stack_trace_parser_esm_parse(stack).filter((frame)=>fullStack ? true : frame.file && !stackIgnores.some((entry)=>frame.file?.match(entry))).map(async (frame)=>{
|
|
2105
2378
|
const sourcemap = await getSourcemap?.(frame.file);
|
|
2106
2379
|
if (sourcemap) {
|
|
2107
|
-
|
|
2380
|
+
let traceMap = traceMapCache.get(frame.file);
|
|
2381
|
+
if (!traceMap) {
|
|
2382
|
+
traceMap = new TraceMap(sourcemap);
|
|
2383
|
+
traceMapCache.set(frame.file, traceMap);
|
|
2384
|
+
}
|
|
2108
2385
|
const { line, column, source, name } = originalPositionFor(traceMap, {
|
|
2109
2386
|
line: frame.lineNumber,
|
|
2110
2387
|
column: frame.column
|
|
@@ -2995,7 +3272,7 @@ const formatFailureListValue = (value)=>{
|
|
|
2995
3272
|
};
|
|
2996
3273
|
const getErrorType = (error)=>{
|
|
2997
3274
|
const rawName = error.name || 'Error';
|
|
2998
|
-
if (
|
|
3275
|
+
if (rawName.includes('AssertionError')) return 'AssertionError';
|
|
2999
3276
|
if (/\bSnapshot\b.*\bmismatched\b/i.test(error.message)) return 'SnapshotMismatchError';
|
|
3000
3277
|
return rawName;
|
|
3001
3278
|
};
|
|
@@ -3183,6 +3460,7 @@ const excludedRoots = (()=>{
|
|
|
3183
3460
|
return resolvedRoots;
|
|
3184
3461
|
})();
|
|
3185
3462
|
const md_parseErrorStacktrace = async ({ stack, getSourcemap, fullStack = false })=>{
|
|
3463
|
+
const traceMapCache = new Map();
|
|
3186
3464
|
const frames = stack_trace_parser_esm_parse(stack).filter((frame)=>{
|
|
3187
3465
|
if (fullStack) return true;
|
|
3188
3466
|
if (!frame.file) return false;
|
|
@@ -3200,7 +3478,11 @@ const md_parseErrorStacktrace = async ({ stack, getSourcemap, fullStack = false
|
|
|
3200
3478
|
...frame,
|
|
3201
3479
|
file
|
|
3202
3480
|
};
|
|
3203
|
-
|
|
3481
|
+
let traceMap = traceMapCache.get(file);
|
|
3482
|
+
if (!traceMap) {
|
|
3483
|
+
traceMap = new TraceMap(sourcemap);
|
|
3484
|
+
traceMapCache.set(file, traceMap);
|
|
3485
|
+
}
|
|
3204
3486
|
const { line, column, source, name } = originalPositionFor(traceMap, {
|
|
3205
3487
|
line: frame.lineNumber || 1,
|
|
3206
3488
|
column: frame.column || 1
|
|
@@ -3289,7 +3571,7 @@ class MdReporter {
|
|
|
3289
3571
|
}
|
|
3290
3572
|
renderFrontMatter(lines) {
|
|
3291
3573
|
const frontMatter = {
|
|
3292
|
-
tool: "@rstest/core@0.9.
|
|
3574
|
+
tool: "@rstest/core@0.9.5",
|
|
3293
3575
|
timestamp: new Date().toISOString()
|
|
3294
3576
|
};
|
|
3295
3577
|
if (this.options.header.env) frontMatter.runtime = {
|
|
@@ -3433,10 +3715,10 @@ class MdReporter {
|
|
|
3433
3715
|
getSourcemap,
|
|
3434
3716
|
fullStack: false
|
|
3435
3717
|
}) : [];
|
|
3436
|
-
const fullFrames = error.stack ? await md_parseErrorStacktrace({
|
|
3718
|
+
const fullFrames = error.fullStack && error.stack ? await md_parseErrorStacktrace({
|
|
3437
3719
|
stack: error.stack,
|
|
3438
3720
|
getSourcemap,
|
|
3439
|
-
fullStack:
|
|
3721
|
+
fullStack: true
|
|
3440
3722
|
}) : candidateFrames;
|
|
3441
3723
|
const trimmedFrames = resolveStackFrames(fullFrames, this.options);
|
|
3442
3724
|
const topFrame = fullFrames[0] ?? candidateFrames[0];
|
|
@@ -3663,7 +3945,7 @@ class Rstest {
|
|
|
3663
3945
|
updateSnapshot: rstestConfig.update ? 'all' : dist_m ? 'none' : 'new'
|
|
3664
3946
|
});
|
|
3665
3947
|
this.snapshotManager = snapshotManager;
|
|
3666
|
-
this.version = "0.9.
|
|
3948
|
+
this.version = "0.9.5";
|
|
3667
3949
|
this.rootPath = rootPath;
|
|
3668
3950
|
this.originalConfig = userConfig;
|
|
3669
3951
|
this.normalizedConfig = rstestConfig;
|