@rstest/core 0.8.5 → 0.9.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/{0~9348.js → 0~1240.js} +41 -41
- package/dist/0~1472.js +2 -2
- package/dist/0~2173.js +84 -71
- package/dist/{0~3919.js → 0~262.js} +31 -30
- package/dist/0~3062.js +1 -1
- package/dist/0~3346.js +1 -1
- package/dist/0~5835.js +1 -1
- package/dist/0~6588.js +1 -1
- package/dist/0~6923.js +2 -2
- package/dist/0~7583.js +1 -1
- package/dist/0~7882.js +24 -23
- package/dist/0~89.js +22 -23
- package/dist/0~9634.js +6 -6
- package/dist/1157.js +1 -1
- package/dist/1294.js +2 -1
- package/dist/3160.js +4 -49
- package/dist/{5960.js → 4597.js} +0 -1
- package/dist/487.js +1 -1
- package/dist/6151.js +108 -31
- package/dist/9131.js +31 -16
- package/dist/browser-runtime/389.js +144 -92
- package/dist/browser-runtime/index.d.ts +40 -10
- package/dist/browser.d.ts +53 -10
- package/dist/index.d.ts +41 -79
- package/dist/worker.d.ts +13 -1521
- package/dist/worker.js +10 -7
- package/package.json +13 -12
package/dist/6151.js
CHANGED
|
@@ -1564,7 +1564,7 @@ function chunk_BVHSVHOK_p(n = !1) {
|
|
|
1564
1564
|
for (let [r, t] of chunk_BVHSVHOK_h)u[r] = e ? g(d(t[0]), d(t[1]), t[2]) : chunk_BVHSVHOK_a;
|
|
1565
1565
|
return u;
|
|
1566
1566
|
}
|
|
1567
|
-
const external_node_tty_ = __webpack_require__("
|
|
1567
|
+
const external_node_tty_ = __webpack_require__("tty");
|
|
1568
1568
|
var node_r = void 0 !== process.env.FORCE_TTY || (0, external_node_tty_.isatty)(1);
|
|
1569
1569
|
var node_u = chunk_BVHSVHOK_p(node_r);
|
|
1570
1570
|
function _mergeNamespaces(n, m) {
|
|
@@ -11877,6 +11877,9 @@ function createExpect({ getCurrentTest, workerState }) {
|
|
|
11877
11877
|
soft: true
|
|
11878
11878
|
});
|
|
11879
11879
|
expect.poll = createExpectPoll(expect);
|
|
11880
|
+
expect.element = ()=>{
|
|
11881
|
+
throw new Error("expect.element() is only available in browser mode. Enable browser mode in config and import @rstest/browser to install the browser expect adapter.");
|
|
11882
|
+
};
|
|
11880
11883
|
expect.unreachable = (message)=>{
|
|
11881
11884
|
chai_assert.fail(`expected ${message ? `"${message}" ` : ''}not to be reached`);
|
|
11882
11885
|
};
|
|
@@ -12025,7 +12028,7 @@ function getFixtureUsedProps(fn) {
|
|
|
12025
12028
|
const trimmedParams = match[1].trim();
|
|
12026
12029
|
if (!trimmedParams) return [];
|
|
12027
12030
|
const [firstParam] = splitByComma(trimmedParams);
|
|
12028
|
-
if (firstParam?.[0] !== '{' || '}'
|
|
12031
|
+
if (firstParam?.[0] !== '{' || !firstParam.endsWith('}')) {
|
|
12029
12032
|
if (firstParam?.startsWith('_')) return [];
|
|
12030
12033
|
throw new Error(`First argument must use the object destructuring pattern: ${firstParam}`);
|
|
12031
12034
|
}
|
|
@@ -12351,7 +12354,8 @@ class TestRunner {
|
|
|
12351
12354
|
project: test.project,
|
|
12352
12355
|
testId: test.testId,
|
|
12353
12356
|
type: 'suite',
|
|
12354
|
-
location: test.location
|
|
12357
|
+
location: test.location,
|
|
12358
|
+
runMode: test.runMode
|
|
12355
12359
|
});
|
|
12356
12360
|
if (0 === test.tests.length) {
|
|
12357
12361
|
if ([
|
|
@@ -12423,7 +12427,8 @@ class TestRunner {
|
|
|
12423
12427
|
parentNames: test.parentNames,
|
|
12424
12428
|
project: test.project,
|
|
12425
12429
|
type: 'case',
|
|
12426
|
-
location: test.location
|
|
12430
|
+
location: test.location,
|
|
12431
|
+
runMode: test.runMode
|
|
12427
12432
|
});
|
|
12428
12433
|
do {
|
|
12429
12434
|
const currentResult = await runTestsCase(test, parentHooks);
|
|
@@ -13057,18 +13062,7 @@ function createRunner({ workerState }) {
|
|
|
13057
13062
|
traverseUpdateTest(tests, testNamePattern);
|
|
13058
13063
|
hooks.onTestFileReady?.({
|
|
13059
13064
|
testPath,
|
|
13060
|
-
tests: tests.map(
|
|
13061
|
-
return {
|
|
13062
|
-
testId: test.testId,
|
|
13063
|
-
name: test.name,
|
|
13064
|
-
parentNames: test.parentNames,
|
|
13065
|
-
testPath: test.testPath,
|
|
13066
|
-
project: test.project,
|
|
13067
|
-
type: test.type,
|
|
13068
|
-
location: test.location,
|
|
13069
|
-
tests: 'suite' === test.type ? test.tests.map(toTestInfo) : []
|
|
13070
|
-
};
|
|
13071
|
-
})
|
|
13065
|
+
tests: tests.map(toTestInfo)
|
|
13072
13066
|
});
|
|
13073
13067
|
runtime.instance.updateStatus('running');
|
|
13074
13068
|
const results = await testRunner.runTests({
|
|
@@ -13084,12 +13078,25 @@ function createRunner({ workerState }) {
|
|
|
13084
13078
|
collectTests: async ()=>{
|
|
13085
13079
|
const tests = await runtime.instance.getTests();
|
|
13086
13080
|
traverseUpdateTest(tests, testNamePattern);
|
|
13087
|
-
return tests;
|
|
13081
|
+
return tests.map(toTestInfo);
|
|
13088
13082
|
},
|
|
13089
13083
|
getCurrentTest: ()=>testRunner.getCurrentTest()
|
|
13090
13084
|
}
|
|
13091
13085
|
};
|
|
13092
13086
|
}
|
|
13087
|
+
function toTestInfo(test) {
|
|
13088
|
+
return {
|
|
13089
|
+
testId: test.testId,
|
|
13090
|
+
name: test.name,
|
|
13091
|
+
parentNames: test.parentNames,
|
|
13092
|
+
testPath: test.testPath,
|
|
13093
|
+
project: test.project,
|
|
13094
|
+
type: test.type,
|
|
13095
|
+
location: test.location,
|
|
13096
|
+
tests: 'suite' === test.type ? test.tests.map(toTestInfo) : [],
|
|
13097
|
+
runMode: test.runMode
|
|
13098
|
+
};
|
|
13099
|
+
}
|
|
13093
13100
|
const fake_timers_src = __webpack_require__("../../node_modules/.pnpm/@sinonjs+fake-timers@15.1.0/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js");
|
|
13094
13101
|
const fakeTimers_RealDate = Date;
|
|
13095
13102
|
class FakeTimers {
|
|
@@ -13322,7 +13329,7 @@ function mockObject(options, object, mockExports = {}) {
|
|
|
13322
13329
|
configurable: descriptor.configurable,
|
|
13323
13330
|
enumerable: descriptor.enumerable,
|
|
13324
13331
|
get: ()=>void 0,
|
|
13325
|
-
set: descriptor.set ? ()=>
|
|
13332
|
+
set: descriptor.set ? ()=>void 0 : void 0
|
|
13326
13333
|
});
|
|
13327
13334
|
} catch {}
|
|
13328
13335
|
continue;
|
|
@@ -13532,11 +13539,34 @@ const initSpy = ()=>{
|
|
|
13532
13539
|
createMockInstance
|
|
13533
13540
|
};
|
|
13534
13541
|
};
|
|
13542
|
+
const DEFAULT_WAIT_TIMEOUT = 1000;
|
|
13543
|
+
const DEFAULT_WAIT_INTERVAL = 50;
|
|
13544
|
+
const getRealSetTimeout = ()=>getRealTimers().setTimeout ?? globalThis.setTimeout.bind(globalThis);
|
|
13545
|
+
const getRealClearTimeout = ()=>getRealTimers().clearTimeout ?? globalThis.clearTimeout.bind(globalThis);
|
|
13546
|
+
const sleep = (ms)=>new Promise((resolve)=>getRealSetTimeout()(resolve, ms));
|
|
13547
|
+
const createWaitForTimeoutError = (timeout, cause)=>new Error(`waitFor timed out in ${timeout}ms`, {
|
|
13548
|
+
cause
|
|
13549
|
+
});
|
|
13550
|
+
const createWaitUntilTimeoutError = (timeout)=>new Error(`waitUntil timed out in ${timeout}ms`);
|
|
13551
|
+
const normalizeWaitOptions = (options)=>({
|
|
13552
|
+
timeout: Math.max(0, 'number' == typeof options ? options : options?.timeout ?? DEFAULT_WAIT_TIMEOUT),
|
|
13553
|
+
interval: Math.max(0, 'number' == typeof options ? DEFAULT_WAIT_INTERVAL : options?.interval ?? DEFAULT_WAIT_INTERVAL)
|
|
13554
|
+
});
|
|
13535
13555
|
const createRstestUtilities = async (workerState)=>{
|
|
13556
|
+
const RSTEST_ENV_SYMBOL = Symbol.for('rstest.env');
|
|
13536
13557
|
const originalEnvValues = new Map();
|
|
13537
13558
|
const originalGlobalValues = new Map();
|
|
13538
13559
|
let _timers;
|
|
13539
13560
|
let originalConfig;
|
|
13561
|
+
const resolveRuntimeEnv = ()=>{
|
|
13562
|
+
const globalRef = globalThis;
|
|
13563
|
+
const runtimeEnv = globalRef[RSTEST_ENV_SYMBOL];
|
|
13564
|
+
if (runtimeEnv && 'object' == typeof runtimeEnv) return runtimeEnv;
|
|
13565
|
+
if ("u" > typeof process && process.env) return process.env;
|
|
13566
|
+
const createdEnv = {};
|
|
13567
|
+
globalRef[RSTEST_ENV_SYMBOL] = createdEnv;
|
|
13568
|
+
return createdEnv;
|
|
13569
|
+
};
|
|
13540
13570
|
const timers = ()=>{
|
|
13541
13571
|
if (!_timers) _timers = new FakeTimers({
|
|
13542
13572
|
global: globalThis
|
|
@@ -13574,15 +13604,15 @@ const createRstestUtilities = async (workerState)=>{
|
|
|
13574
13604
|
for (const mock of mocks)mock.mockRestore();
|
|
13575
13605
|
return rstest;
|
|
13576
13606
|
},
|
|
13577
|
-
mock: ()=>
|
|
13578
|
-
mockRequire: ()=>
|
|
13579
|
-
doMock: ()=>
|
|
13580
|
-
doMockRequire: ()=>
|
|
13581
|
-
unmock: ()=>
|
|
13582
|
-
doUnmock: ()=>
|
|
13583
|
-
importMock:
|
|
13607
|
+
mock: ()=>void 0,
|
|
13608
|
+
mockRequire: ()=>void 0,
|
|
13609
|
+
doMock: ()=>void 0,
|
|
13610
|
+
doMockRequire: ()=>void 0,
|
|
13611
|
+
unmock: ()=>void 0,
|
|
13612
|
+
doUnmock: ()=>void 0,
|
|
13613
|
+
importMock: ()=>Promise.resolve({}),
|
|
13584
13614
|
requireMock: ()=>({}),
|
|
13585
|
-
importActual:
|
|
13615
|
+
importActual: ()=>Promise.resolve({}),
|
|
13586
13616
|
requireActual: ()=>({}),
|
|
13587
13617
|
resetModules: ()=>({}),
|
|
13588
13618
|
hoisted: ()=>({}),
|
|
@@ -13608,14 +13638,16 @@ const createRstestUtilities = async (workerState)=>{
|
|
|
13608
13638
|
if (originalConfig) Object.assign(workerState.runtimeConfig, originalConfig);
|
|
13609
13639
|
},
|
|
13610
13640
|
stubEnv: (name, value)=>{
|
|
13611
|
-
|
|
13612
|
-
if (
|
|
13613
|
-
|
|
13641
|
+
const runtimeEnv = resolveRuntimeEnv();
|
|
13642
|
+
if (!originalEnvValues.has(name)) originalEnvValues.set(name, runtimeEnv[name]);
|
|
13643
|
+
if (void 0 === value) delete runtimeEnv[name];
|
|
13644
|
+
else runtimeEnv[name] = value;
|
|
13614
13645
|
return rstest;
|
|
13615
13646
|
},
|
|
13616
13647
|
unstubAllEnvs: ()=>{
|
|
13617
|
-
|
|
13618
|
-
|
|
13648
|
+
const runtimeEnv = resolveRuntimeEnv();
|
|
13649
|
+
for (const [name, value] of originalEnvValues)if (void 0 === value) delete runtimeEnv[name];
|
|
13650
|
+
else runtimeEnv[name] = value;
|
|
13619
13651
|
originalEnvValues.clear();
|
|
13620
13652
|
return rstest;
|
|
13621
13653
|
},
|
|
@@ -13695,6 +13727,51 @@ const createRstestUtilities = async (workerState)=>{
|
|
|
13695
13727
|
clearAllTimers: ()=>{
|
|
13696
13728
|
timers().clearAllTimers();
|
|
13697
13729
|
return rstest;
|
|
13730
|
+
},
|
|
13731
|
+
waitFor: async (callback, options)=>{
|
|
13732
|
+
const { timeout, interval } = normalizeWaitOptions(options);
|
|
13733
|
+
const clearTimeoutFn = getRealClearTimeout();
|
|
13734
|
+
let timedOut = false;
|
|
13735
|
+
let lastError;
|
|
13736
|
+
const timeoutId = getRealSetTimeout()(()=>{
|
|
13737
|
+
timedOut = true;
|
|
13738
|
+
}, timeout);
|
|
13739
|
+
try {
|
|
13740
|
+
while(true){
|
|
13741
|
+
if (timedOut) throw lastError ?? createWaitForTimeoutError(timeout);
|
|
13742
|
+
try {
|
|
13743
|
+
const value = await callback();
|
|
13744
|
+
if (timedOut) throw lastError ?? createWaitForTimeoutError(timeout);
|
|
13745
|
+
return value;
|
|
13746
|
+
} catch (error) {
|
|
13747
|
+
lastError = error;
|
|
13748
|
+
}
|
|
13749
|
+
if (timedOut) throw lastError ?? createWaitForTimeoutError(timeout);
|
|
13750
|
+
await sleep(interval);
|
|
13751
|
+
}
|
|
13752
|
+
} finally{
|
|
13753
|
+
clearTimeoutFn(timeoutId);
|
|
13754
|
+
}
|
|
13755
|
+
},
|
|
13756
|
+
waitUntil: async (callback, options)=>{
|
|
13757
|
+
const { timeout, interval } = normalizeWaitOptions(options);
|
|
13758
|
+
const clearTimeoutFn = getRealClearTimeout();
|
|
13759
|
+
let timedOut = false;
|
|
13760
|
+
const timeoutId = getRealSetTimeout()(()=>{
|
|
13761
|
+
timedOut = true;
|
|
13762
|
+
}, timeout);
|
|
13763
|
+
try {
|
|
13764
|
+
while(true){
|
|
13765
|
+
if (timedOut) throw createWaitUntilTimeoutError(timeout);
|
|
13766
|
+
const value = await callback();
|
|
13767
|
+
if (timedOut) throw createWaitUntilTimeoutError(timeout);
|
|
13768
|
+
if (value) return value;
|
|
13769
|
+
if (timedOut) throw createWaitUntilTimeoutError(timeout);
|
|
13770
|
+
await sleep(interval);
|
|
13771
|
+
}
|
|
13772
|
+
} finally{
|
|
13773
|
+
clearTimeoutFn(timeoutId);
|
|
13774
|
+
}
|
|
13698
13775
|
}
|
|
13699
13776
|
};
|
|
13700
13777
|
return rstest;
|
package/dist/9131.js
CHANGED
|
@@ -504,13 +504,13 @@ function prepareCli() {
|
|
|
504
504
|
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) logger_logger.log();
|
|
505
505
|
}
|
|
506
506
|
function showRstest() {
|
|
507
|
-
logger_logger.greet(" Rstest v0.
|
|
507
|
+
logger_logger.greet(" Rstest v0.9.0");
|
|
508
508
|
logger_logger.log('');
|
|
509
509
|
}
|
|
510
510
|
const applyCommonOptions = (cli)=>{
|
|
511
|
-
cli.option('-c, --config <config>', 'Specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'Specify the loader to load the config file
|
|
512
|
-
default: '
|
|
513
|
-
}).option('-r, --root <root>', 'Specify the project root directory, can be an absolute path or a path relative to cwd').option('--globals', 'Provide global APIs').option('--isolate', 'Run tests in an isolated environment').option('--include <include>', 'Match test files').option('--exclude <exclude>', 'Exclude files from test').option('-u, --update', 'Update snapshot files').option('--coverage', 'Enable code coverage collection').option('--project <name>', 'Run only projects that match the name, can be a full name or wildcards pattern').option('--passWithNoTests', 'Allows the test suite to pass when no files are found').option('--printConsoleTrace', 'Print console traces when calling any console method').option('--disableConsoleIntercept', 'Disable console intercept').option('--logHeapUsage', 'Log heap usage after each test').option('--slowTestThreshold <value>', 'The number of milliseconds after which a test or suite is considered slow').option('--reporter <reporter>', 'Specify the reporter to use').option('-t, --testNamePattern <value>', 'Run only tests with a name that matches the regex').option('--testEnvironment <name>', 'The environment that will be used for testing').option('--testTimeout <value>', 'Timeout of a test in milliseconds').option('--hookTimeout <value>', 'Timeout of hook in milliseconds').option('--hideSkippedTests', 'Hide skipped tests from the output').option('--hideSkippedTestFiles', 'Hide skipped test files from the output').option('--retry <retry>', 'Number of times to retry a test if it fails').option('--bail [number]', 'Stop running tests after n failures. Set to 0 to run all tests regardless of failures').option('--shard <index/count>', 'Split tests into several shards. This is useful for running tests in parallel on multiple machines.').option('--maxConcurrency <value>', 'Maximum number of concurrent tests').option('--clearMocks', 'Automatically clear mock calls, instances, contexts and results before every test').option('--resetMocks', 'Automatically reset mock state before every test').option('--restoreMocks', 'Automatically restore mock state and implementation before every test').option('--browser', 'Run tests in browser mode').option('--browser.enabled', 'Run tests in browser mode').option('--browser.name <name>', 'Browser to use: chromium, firefox, webkit (default: chromium)').option('--browser.headless', 'Run browser in headless mode (default: true in CI)').option('--browser.port <port>', 'Port for the browser mode dev server').option('--browser.strictPort', 'Exit if the specified port is already in use').option('--unstubGlobals', 'Restores all global variables that were changed with `rstest.stubGlobal` before every test').option('--unstubEnvs', 'Restores all
|
|
511
|
+
cli.option('-c, --config <config>', 'Specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'Specify the loader to load the config file (auto | jiti | native)', {
|
|
512
|
+
default: 'auto'
|
|
513
|
+
}).option('-r, --root <root>', 'Specify the project root directory, can be an absolute path or a path relative to cwd').option('--globals', 'Provide global APIs').option('--isolate', 'Run tests in an isolated environment').option('--include <include>', 'Match test files').option('--exclude <exclude>', 'Exclude files from test').option('-u, --update', 'Update snapshot files').option('--coverage', 'Enable code coverage collection').option('--project <name>', 'Run only projects that match the name, can be a full name or wildcards pattern').option('--passWithNoTests', 'Allows the test suite to pass when no files are found').option('--printConsoleTrace', 'Print console traces when calling any console method').option('--disableConsoleIntercept', 'Disable console intercept').option('--logHeapUsage', 'Log heap usage after each test').option('--slowTestThreshold <value>', 'The number of milliseconds after which a test or suite is considered slow').option('--reporter <reporter>', 'Specify the reporter to use').option('-t, --testNamePattern <value>', 'Run only tests with a name that matches the regex').option('--testEnvironment <name>', 'The environment that will be used for testing').option('--testTimeout <value>', 'Timeout of a test in milliseconds').option('--hookTimeout <value>', 'Timeout of hook in milliseconds').option('--hideSkippedTests', 'Hide skipped tests from the output').option('--hideSkippedTestFiles', 'Hide skipped test files from the output').option('--retry <retry>', 'Number of times to retry a test if it fails').option('--bail [number]', 'Stop running tests after n failures. Set to 0 to run all tests regardless of failures').option('--shard <index/count>', 'Split tests into several shards. This is useful for running tests in parallel on multiple machines.').option('--maxConcurrency <value>', 'Maximum number of concurrent tests').option('--clearMocks', 'Automatically clear mock calls, instances, contexts and results before every test').option('--resetMocks', 'Automatically reset mock state before every test').option('--restoreMocks', 'Automatically restore mock state and implementation before every test').option('--browser', 'Run tests in browser mode').option('--browser.enabled', 'Run tests in browser mode').option('--browser.name <name>', 'Browser to use: chromium, firefox, webkit (default: chromium)').option('--browser.headless', 'Run browser in headless mode (default: true in CI)').option('--browser.port <port>', 'Port for the browser mode dev server').option('--browser.strictPort', 'Exit if the specified port is already in use').option('--unstubGlobals', 'Restores all global variables that were changed with `rstest.stubGlobal` before every test').option('--unstubEnvs', 'Restores all runtime env values that were changed with `rstest.stubEnv` before every test').option('--includeTaskLocation', 'Collect test and suite locations. This might increase the running time.');
|
|
514
514
|
cli.option('--pool <type>', 'Shorthand for --pool.type').option('--pool.type <type>', 'Specify the test pool type (e.g. forks)').option('--pool.maxWorkers <value>', 'Maximum number or percentage of workers (e.g. 4 or 50%)').option('--pool.minWorkers <value>', 'Minimum number or percentage of workers (e.g. 1 or 25%)').option('--pool.execArgv <arg>', 'Additional Node.js execArgv passed to worker processes (can be specified multiple times)');
|
|
515
515
|
};
|
|
516
516
|
const handleUnexpectedExit = (rstest, err)=>{
|
|
@@ -562,7 +562,7 @@ const runRest = async ({ options, filters, command })=>{
|
|
|
562
562
|
function setupCommands() {
|
|
563
563
|
const cli = dist('rstest');
|
|
564
564
|
cli.help();
|
|
565
|
-
cli.version("0.
|
|
565
|
+
cli.version("0.9.0");
|
|
566
566
|
applyCommonOptions(cli);
|
|
567
567
|
cli.command('[...filters]', 'run tests').option('-w, --watch', 'Run tests in watch mode').action(async (filters, options)=>{
|
|
568
568
|
if (!determineAgent().isAgent) showRstest();
|
|
@@ -624,7 +624,7 @@ function setupCommands() {
|
|
|
624
624
|
try {
|
|
625
625
|
let selectedProject = project;
|
|
626
626
|
if (!selectedProject) {
|
|
627
|
-
const { select, isCancel } = await import("./0~
|
|
627
|
+
const { select, isCancel } = await import("./0~1240.js").then((mod)=>({
|
|
628
628
|
select: mod.ve,
|
|
629
629
|
isCancel: mod.pD
|
|
630
630
|
}));
|
|
@@ -1384,7 +1384,7 @@ async function init_initCli(options) {
|
|
|
1384
1384
|
projects
|
|
1385
1385
|
};
|
|
1386
1386
|
}
|
|
1387
|
-
|
|
1387
|
+
function runCLI() {
|
|
1388
1388
|
process.title = 'rstest-node';
|
|
1389
1389
|
prepareCli();
|
|
1390
1390
|
try {
|
|
@@ -1546,6 +1546,9 @@ class WindowRenderer {
|
|
|
1546
1546
|
windowHeight = 0;
|
|
1547
1547
|
finished = false;
|
|
1548
1548
|
cleanups = [];
|
|
1549
|
+
exitHandler = ()=>{
|
|
1550
|
+
this.finish();
|
|
1551
|
+
};
|
|
1549
1552
|
constructor(options){
|
|
1550
1553
|
this.options = {
|
|
1551
1554
|
interval: DEFAULT_RENDER_INTERVAL_MS,
|
|
@@ -1557,6 +1560,7 @@ class WindowRenderer {
|
|
|
1557
1560
|
};
|
|
1558
1561
|
this.cleanups.push(this.interceptStream(process.stdout, 'output'), this.interceptStream(process.stderr, 'error'));
|
|
1559
1562
|
this.start();
|
|
1563
|
+
process.once('exit', this.exitHandler);
|
|
1560
1564
|
}
|
|
1561
1565
|
start() {
|
|
1562
1566
|
this.finished = false;
|
|
@@ -1570,6 +1574,7 @@ class WindowRenderer {
|
|
|
1570
1574
|
this.finished = true;
|
|
1571
1575
|
this.flushBuffer();
|
|
1572
1576
|
clearInterval(this.renderInterval);
|
|
1577
|
+
process.removeListener('exit', this.exitHandler);
|
|
1573
1578
|
}
|
|
1574
1579
|
schedule() {
|
|
1575
1580
|
if (!this.renderScheduled) {
|
|
@@ -1800,7 +1805,7 @@ class DefaultReporter {
|
|
|
1800
1805
|
logOutput(log.content);
|
|
1801
1806
|
logOutput('');
|
|
1802
1807
|
}
|
|
1803
|
-
|
|
1808
|
+
onExit() {
|
|
1804
1809
|
this.statusRenderer?.clear();
|
|
1805
1810
|
}
|
|
1806
1811
|
async onTestRunEnd({ results, testResults, duration, getSourcemap, snapshotSummary, filterRerunTestPaths, unhandledErrors }) {
|
|
@@ -2191,8 +2196,9 @@ function traceSegmentInternal(segments, memo, line, column, bias) {
|
|
|
2191
2196
|
if (-1 === index || index === segments.length) return -1;
|
|
2192
2197
|
return index;
|
|
2193
2198
|
}
|
|
2194
|
-
const external_node_path_ = __webpack_require__("path");
|
|
2199
|
+
const external_node_path_ = __webpack_require__("node:path");
|
|
2195
2200
|
const isRelativePath = (p)=>/^\.\.?\//.test(p);
|
|
2201
|
+
const isHttpLikeFile = (file)=>/^https?:\/\//.test(file);
|
|
2196
2202
|
const hintNotDefinedError = (message)=>{
|
|
2197
2203
|
const [, varName] = message.match(/(\w+) is not defined/) || [];
|
|
2198
2204
|
if (varName) {
|
|
@@ -2239,7 +2245,7 @@ async function printCodeFrame(frame) {
|
|
|
2239
2245
|
if (!filePath) return;
|
|
2240
2246
|
const source = external_node_fs_["default"].existsSync(filePath) ? external_node_fs_["default"].readFileSync(filePath, 'utf-8') : void 0;
|
|
2241
2247
|
if (!source) return;
|
|
2242
|
-
const { codeFrameColumns } = await import("./0~
|
|
2248
|
+
const { codeFrameColumns } = await import("./0~262.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/@babel+code-frame@7.29.0/node_modules/@babel/code-frame/lib/index.js"));
|
|
2243
2249
|
const result = codeFrameColumns(source, {
|
|
2244
2250
|
start: {
|
|
2245
2251
|
line: frame.lineNumber,
|
|
@@ -2298,7 +2304,14 @@ async function error_parseErrorStacktrace({ stack, getSourcemap, fullStack = isD
|
|
|
2298
2304
|
}
|
|
2299
2305
|
return frame;
|
|
2300
2306
|
})).then((frames)=>frames.filter((frame)=>null !== frame));
|
|
2301
|
-
return stackFrames;
|
|
2307
|
+
if (fullStack) return stackFrames;
|
|
2308
|
+
const filteredFrames = stackFrames.filter((frame)=>{
|
|
2309
|
+
if (!frame.file) return false;
|
|
2310
|
+
if (isHttpLikeFile(frame.file)) return false;
|
|
2311
|
+
const normalizedFile = frame.file.replace(/\\/g, '/');
|
|
2312
|
+
return !stackIgnores.some((entry)=>normalizedFile.match(entry));
|
|
2313
|
+
});
|
|
2314
|
+
return filteredFrames;
|
|
2302
2315
|
}
|
|
2303
2316
|
class JUnitReporter {
|
|
2304
2317
|
rootPath;
|
|
@@ -3011,6 +3024,7 @@ const defaultOptions = {
|
|
|
3011
3024
|
env: true
|
|
3012
3025
|
},
|
|
3013
3026
|
reproduction: 'file+name',
|
|
3027
|
+
testLists: 'auto',
|
|
3014
3028
|
failures: {
|
|
3015
3029
|
max: 50
|
|
3016
3030
|
},
|
|
@@ -3118,6 +3132,7 @@ const resolveOptions = (userOptions = {})=>{
|
|
|
3118
3132
|
preset: presetName,
|
|
3119
3133
|
header: resolveHeader(userOptions.header),
|
|
3120
3134
|
reproduction: resolveReproduction(userOptions.reproduction),
|
|
3135
|
+
testLists: userOptions.testLists ?? defaultOptions.testLists,
|
|
3121
3136
|
failures: resolveFailures(userOptions.failures, preset),
|
|
3122
3137
|
codeFrame: resolveCodeFrame(userOptions.codeFrame, preset),
|
|
3123
3138
|
stack: resolveStack(userOptions.stack, preset),
|
|
@@ -3452,7 +3467,7 @@ class MdReporter {
|
|
|
3452
3467
|
}
|
|
3453
3468
|
renderFrontMatter(lines) {
|
|
3454
3469
|
const frontMatter = {
|
|
3455
|
-
tool: "@rstest/core@0.
|
|
3470
|
+
tool: "@rstest/core@0.9.0",
|
|
3456
3471
|
timestamp: new Date().toISOString()
|
|
3457
3472
|
};
|
|
3458
3473
|
if (this.options.header.env) frontMatter.runtime = {
|
|
@@ -3541,7 +3556,7 @@ class MdReporter {
|
|
|
3541
3556
|
pushHeading(lines, 1, 'Rstest Test Execution Report');
|
|
3542
3557
|
pushHeading(lines, 2, 'Summary');
|
|
3543
3558
|
pushFencedBlock(lines, 'json', stringifyJson(summaryPayload));
|
|
3544
|
-
if ('pass' === status && focusedRun) this.renderTestsSection(lines, {
|
|
3559
|
+
if ('always' === this.options.testLists || 'pass' === status && focusedRun) this.renderTestsSection(lines, {
|
|
3545
3560
|
passed: passedTests,
|
|
3546
3561
|
skipped: skippedTests,
|
|
3547
3562
|
todo: todoTests
|
|
@@ -3676,7 +3691,7 @@ class MdReporter {
|
|
|
3676
3691
|
}
|
|
3677
3692
|
} else {
|
|
3678
3693
|
lines.push('No test failures reported.');
|
|
3679
|
-
if ('pass' === status && !focusedRun) {
|
|
3694
|
+
if ('pass' === status && !focusedRun && 'always' !== this.options.testLists) {
|
|
3680
3695
|
ensureSingleBlankLine(lines);
|
|
3681
3696
|
lines.push('Note: all tests passed. Lists omitted for brevity.');
|
|
3682
3697
|
}
|
|
@@ -3822,7 +3837,7 @@ class Rstest {
|
|
|
3822
3837
|
updateSnapshot: rstestConfig.update ? 'all' : T ? 'none' : 'new'
|
|
3823
3838
|
});
|
|
3824
3839
|
this.snapshotManager = snapshotManager;
|
|
3825
|
-
this.version = "0.
|
|
3840
|
+
this.version = "0.9.0";
|
|
3826
3841
|
this.rootPath = rootPath;
|
|
3827
3842
|
this.originalConfig = userConfig;
|
|
3828
3843
|
this.normalizedConfig = rstestConfig;
|
|
@@ -3918,7 +3933,7 @@ function createReporters(reporters, initConfig = {}) {
|
|
|
3918
3933
|
}
|
|
3919
3934
|
});
|
|
3920
3935
|
}
|
|
3921
|
-
throw new Error(`Reporter ${
|
|
3936
|
+
throw new Error(`Reporter ${name} not found. Please install it or use a built-in reporter.`);
|
|
3922
3937
|
}
|
|
3923
3938
|
return reporter;
|
|
3924
3939
|
});
|