@rstest/core 0.6.6 → 0.6.7
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~122.js +6 -2
- package/dist/0~173.js +4 -0
- package/dist/0~255.js +1 -1
- package/dist/0~583.js +1 -1
- package/dist/0~634.js +1 -1
- package/dist/155.js +8 -8
- package/dist/362.js +8 -2
- package/dist/946.js +2 -2
- package/{dist-types → dist}/index.d.ts +1 -1
- package/package.json +3 -4
- /package/{dist-types → dist}/worker.d.ts +0 -0
package/dist/0~122.js
CHANGED
|
@@ -446,7 +446,7 @@ const pluginEntryWatch = ({ isWatch, globTestSourceEntries, setupFiles, context
|
|
|
446
446
|
});
|
|
447
447
|
const autoExternalNodeModules = ({ context, request, dependencyType, getResolve }, callback)=>{
|
|
448
448
|
if (!request) return callback();
|
|
449
|
-
if (request.startsWith('@swc/helpers/')) return callback();
|
|
449
|
+
if (request.startsWith('@swc/helpers/') || request.endsWith('.wasm')) return callback();
|
|
450
450
|
const doExternal = (externalPath = request)=>{
|
|
451
451
|
callback(void 0, externalPath, 'commonjs' === dependencyType ? 'commonjs' : 'import');
|
|
452
452
|
};
|
|
@@ -527,7 +527,7 @@ const pluginInspect = ()=>enable ? {
|
|
|
527
527
|
});
|
|
528
528
|
}
|
|
529
529
|
} : null;
|
|
530
|
-
const external_node_fs_ = __webpack_require__("fs");
|
|
530
|
+
const external_node_fs_ = __webpack_require__("node:fs");
|
|
531
531
|
const mockRuntime_dirname = external_node_path_["default"].dirname(fileURLToPath(import.meta.url));
|
|
532
532
|
class MockRuntimeRspackPlugin {
|
|
533
533
|
apply(compiler) {
|
|
@@ -551,6 +551,10 @@ class MockRuntimeRspackPlugin {
|
|
|
551
551
|
const finalSource = module.source.source.toString('utf-8').replace('enumerable: true, get:', 'enumerable: true, configurable: true, get:');
|
|
552
552
|
module.source.source = Buffer.from(finalSource);
|
|
553
553
|
}
|
|
554
|
+
if ('async_wasm_loading' === module.name) {
|
|
555
|
+
const finalSource = module.source.source.toString('utf-8').replace('readFile(', 'readWasmFile(');
|
|
556
|
+
module.source.source = Buffer.from(finalSource);
|
|
557
|
+
}
|
|
554
558
|
});
|
|
555
559
|
});
|
|
556
560
|
compiler.hooks.thisCompilation.tap('RstestMockPlugin', (compilation)=>{
|
package/dist/0~173.js
CHANGED
|
@@ -280,6 +280,10 @@ async function runTests(context) {
|
|
|
280
280
|
}));
|
|
281
281
|
await generateCoverage(context, results, coverageProvider);
|
|
282
282
|
}
|
|
283
|
+
if (isFailure) {
|
|
284
|
+
const bail = context.normalizedConfig.bail;
|
|
285
|
+
if (bail && context.stateManager.getCountOfFailedTests() >= bail) src_logger.log(picocolors_default().yellow(`Test run aborted due to reaching the bail limit of ${bail} failed test(s).`));
|
|
286
|
+
}
|
|
283
287
|
};
|
|
284
288
|
if ('watch' === command) {
|
|
285
289
|
const enableCliShortcuts = isCliShortcutsEnabled();
|
package/dist/0~255.js
CHANGED
|
@@ -2,7 +2,7 @@ import 'module';
|
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
4
|
import "./946.js";
|
|
5
|
-
const external_node_fs_ = __webpack_require__("fs");
|
|
5
|
+
const external_node_fs_ = __webpack_require__("node:fs");
|
|
6
6
|
const pluginCoverageCore = (coverageOptions)=>({
|
|
7
7
|
name: 'rstest:coverage-core',
|
|
8
8
|
setup: (api)=>{
|
package/dist/0~583.js
CHANGED
|
@@ -220,7 +220,7 @@ function readdirp(root, options = {}) {
|
|
|
220
220
|
options.root = root;
|
|
221
221
|
return new ReaddirpStream(options);
|
|
222
222
|
}
|
|
223
|
-
const external_node_fs_ = __webpack_require__("fs");
|
|
223
|
+
const external_node_fs_ = __webpack_require__("node:fs");
|
|
224
224
|
const external_node_os_ = __webpack_require__("node:os");
|
|
225
225
|
const STR_DATA = 'data';
|
|
226
226
|
const STR_END = 'end';
|
package/dist/0~634.js
CHANGED
|
@@ -3,7 +3,7 @@ import 'module';
|
|
|
3
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
4
|
import { getTestEntries, getSetupFiles, getTaskNameWithPrefix, prettyTestPath, src_logger } from "./946.js";
|
|
5
5
|
import { prepareRsbuild, createPool, createRsbuildServer } from "./0~122.js";
|
|
6
|
-
const external_node_fs_ = __webpack_require__("fs");
|
|
6
|
+
const external_node_fs_ = __webpack_require__("node:fs");
|
|
7
7
|
const external_node_path_ = __webpack_require__("node:path");
|
|
8
8
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
9
9
|
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
package/dist/155.js
CHANGED
|
@@ -500,13 +500,13 @@ function prepareCli() {
|
|
|
500
500
|
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
|
|
501
501
|
}
|
|
502
502
|
function showRstest() {
|
|
503
|
-
src_logger.greet(" Rstest v0.6.
|
|
503
|
+
src_logger.greet(" Rstest v0.6.7");
|
|
504
504
|
src_logger.log('');
|
|
505
505
|
}
|
|
506
506
|
const applyCommonOptions = (cli)=>{
|
|
507
507
|
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, can be `jiti` or `native`', {
|
|
508
508
|
default: 'jiti'
|
|
509
|
-
}).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('--retry <retry>', 'Number of times to retry a test if it fails').option('--bail
|
|
509
|
+
}).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('--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('--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('--unstubGlobals', 'Restores all global variables that were changed with `rstest.stubGlobal` before every test').option('--unstubEnvs', 'Restores all `process.env` values that were changed with `rstest.stubEnv` before every test');
|
|
510
510
|
};
|
|
511
511
|
const runRest = async ({ options, filters, command })=>{
|
|
512
512
|
let rstest;
|
|
@@ -544,7 +544,7 @@ const runRest = async ({ options, filters, command })=>{
|
|
|
544
544
|
function setupCommands() {
|
|
545
545
|
const cli = dist('rstest');
|
|
546
546
|
cli.help();
|
|
547
|
-
cli.version("0.6.
|
|
547
|
+
cli.version("0.6.7");
|
|
548
548
|
applyCommonOptions(cli);
|
|
549
549
|
cli.command('[...filters]', 'run tests').option('-w, --watch', 'Run tests in watch mode').action(async (filters, options)=>{
|
|
550
550
|
showRstest();
|
|
@@ -601,7 +601,7 @@ function setupCommands() {
|
|
|
601
601
|
});
|
|
602
602
|
cli.parse();
|
|
603
603
|
}
|
|
604
|
-
const external_node_fs_ = __webpack_require__("fs");
|
|
604
|
+
const external_node_fs_ = __webpack_require__("node:fs");
|
|
605
605
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
606
606
|
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
607
607
|
const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(external_node_fs_["default"].existsSync);
|
|
@@ -772,11 +772,11 @@ async function resolveConfig(options) {
|
|
|
772
772
|
'disableConsoleIntercept',
|
|
773
773
|
'testEnvironment',
|
|
774
774
|
'hideSkippedTests',
|
|
775
|
-
'logHeapUsage'
|
|
776
|
-
'bail'
|
|
775
|
+
'logHeapUsage'
|
|
777
776
|
];
|
|
778
777
|
for (const key of keys)if (void 0 !== options[key]) config[key] = options[key];
|
|
779
778
|
if (options.reporter) config.reporters = castArray(options.reporter);
|
|
779
|
+
if (void 0 !== options.bail && ('number' == typeof options.bail || 'boolean' == typeof options.bail)) config.bail = Number(options.bail);
|
|
780
780
|
if (void 0 !== options.coverage) {
|
|
781
781
|
config.coverage ??= {};
|
|
782
782
|
config.coverage.enabled = options.coverage;
|
|
@@ -2158,7 +2158,7 @@ async function error_printError(error, getSourcemap, rootPath) {
|
|
|
2158
2158
|
fullStack: error.fullStack,
|
|
2159
2159
|
getSourcemap
|
|
2160
2160
|
});
|
|
2161
|
-
if (!stackFrames.length && error.stack.
|
|
2161
|
+
if (!stackFrames.length && !(error.fullStack || isDebug()) && !error.stack.endsWith(error.message)) src_logger.log(picocolors_default().gray("No error stack found, set 'DEBUG=rstest' to show fullStack."));
|
|
2162
2162
|
if (stackFrames[0]) await printCodeFrame(stackFrames[0]);
|
|
2163
2163
|
printStack(stackFrames, rootPath);
|
|
2164
2164
|
}
|
|
@@ -2417,7 +2417,7 @@ class Rstest {
|
|
|
2417
2417
|
});
|
|
2418
2418
|
this.reporters = reporters;
|
|
2419
2419
|
this.snapshotManager = snapshotManager;
|
|
2420
|
-
this.version = "0.6.
|
|
2420
|
+
this.version = "0.6.7";
|
|
2421
2421
|
this.rootPath = rootPath;
|
|
2422
2422
|
this.originalConfig = userConfig;
|
|
2423
2423
|
this.normalizedConfig = rstestConfig;
|
package/dist/362.js
CHANGED
|
@@ -4859,7 +4859,7 @@ __webpack_require__.add({
|
|
|
4859
4859
|
var path = __webpack_require__("node:path");
|
|
4860
4860
|
var fs;
|
|
4861
4861
|
try {
|
|
4862
|
-
fs = __webpack_require__("fs");
|
|
4862
|
+
fs = __webpack_require__("node:fs");
|
|
4863
4863
|
if (!fs.existsSync || !fs.readFileSync) fs = null;
|
|
4864
4864
|
} catch (err) {}
|
|
4865
4865
|
var bufferFrom = __webpack_require__("../../node_modules/.pnpm/buffer-from@1.1.2/node_modules/buffer-from/index.js");
|
|
@@ -6849,6 +6849,12 @@ const loadModule = ({ codeContent, distPath, testPath, rstestContext, assetFiles
|
|
|
6849
6849
|
module: localModule,
|
|
6850
6850
|
exports: localModule.exports,
|
|
6851
6851
|
require: createRequire(testPath, distPath, rstestContext, assetFiles, interopDefault),
|
|
6852
|
+
readWasmFile: (wasmPath, callback)=>{
|
|
6853
|
+
const joinedPath = isRelativePath(wasmPath) ? posix.join(posix.dirname(distPath), wasmPath) : wasmPath;
|
|
6854
|
+
const content = assetFiles[posix.normalize(joinedPath)];
|
|
6855
|
+
if (content) callback(null, Buffer.from(content, 'utf-8'));
|
|
6856
|
+
else callback(new Error(`WASM file ${joinedPath} not found in asset files.`));
|
|
6857
|
+
},
|
|
6852
6858
|
__rstest_dynamic_import__: defineRstestDynamicImport({
|
|
6853
6859
|
testPath,
|
|
6854
6860
|
interopDefault
|
|
@@ -6936,7 +6942,7 @@ function createRuntimeRpc(options, { originalConsole }) {
|
|
|
6936
6942
|
rpc
|
|
6937
6943
|
};
|
|
6938
6944
|
}
|
|
6939
|
-
const external_node_fs_ = __webpack_require__("fs");
|
|
6945
|
+
const external_node_fs_ = __webpack_require__("node:fs");
|
|
6940
6946
|
class NodeSnapshotEnvironment {
|
|
6941
6947
|
constructor(options = {}){
|
|
6942
6948
|
this.options = options;
|
package/dist/946.js
CHANGED
|
@@ -1484,7 +1484,7 @@ __webpack_require__.add({
|
|
|
1484
1484
|
return last;
|
|
1485
1485
|
};
|
|
1486
1486
|
},
|
|
1487
|
-
fs: function(module) {
|
|
1487
|
+
"node:fs": function(module) {
|
|
1488
1488
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__;
|
|
1489
1489
|
},
|
|
1490
1490
|
"node:os": function(module) {
|
|
@@ -2338,7 +2338,7 @@ const ADDITIONAL_NODE_BUILTINS = [
|
|
|
2338
2338
|
];
|
|
2339
2339
|
const isTTY = (type = 'stdout')=>('stdin' === type ? process.stdin.isTTY : process.stdout.isTTY) && !process.env.CI;
|
|
2340
2340
|
const external_node_path_ = __webpack_require__("node:path");
|
|
2341
|
-
const external_node_fs_ = __webpack_require__("fs");
|
|
2341
|
+
const external_node_fs_ = __webpack_require__("node:fs");
|
|
2342
2342
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
2343
2343
|
function cleanPath(path) {
|
|
2344
2344
|
let normalized = (0, external_node_path_.normalize)(path);
|
|
@@ -337,7 +337,7 @@ declare type CommonOptions = {
|
|
|
337
337
|
maxConcurrency?: number;
|
|
338
338
|
slowTestThreshold?: number;
|
|
339
339
|
hideSkippedTests?: boolean;
|
|
340
|
-
bail?: number;
|
|
340
|
+
bail?: number | boolean;
|
|
341
341
|
};
|
|
342
342
|
|
|
343
343
|
declare type CompareKeys = ((a: string, b: string) => number) | null | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rstest/core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.7",
|
|
4
4
|
"description": "The Rsbuild-based test tool.",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rstest/issues"
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"type": "module",
|
|
21
21
|
"main": "./dist/index.js",
|
|
22
|
-
"types": "./dist
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
23
|
"bin": {
|
|
24
24
|
"rstest": "./bin/rstest.js"
|
|
25
25
|
},
|
|
26
26
|
"exports": {
|
|
27
27
|
".": {
|
|
28
|
-
"types": "./dist
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
29
|
"default": "./dist/index.js"
|
|
30
30
|
},
|
|
31
31
|
"./package.json": {
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"files": [
|
|
42
42
|
"bin",
|
|
43
43
|
"dist",
|
|
44
|
-
"dist-types",
|
|
45
44
|
"compiled",
|
|
46
45
|
"globals.d.ts",
|
|
47
46
|
"importMeta.d.ts"
|
|
File without changes
|