@rstest/core 0.7.5 → 0.7.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/LICENSE.md +1 -1
- package/dist/0~130.js +2 -2
- package/dist/{0~173.js → 0~2173.js} +10 -8
- package/dist/{0~255.js → 0~2255.js} +1 -1
- package/dist/{0~346.js → 0~3346.js} +2 -2
- package/dist/{0~919.js → 0~3919.js} +1 -1
- package/dist/{0~403.js → 0~4403.js} +3 -3
- package/dist/{0~809.js → 0~4809.js} +2 -2
- package/dist/{0~835.js → 0~5835.js} +12 -8
- package/dist/{0~151.js → 0~6151.js} +163 -292
- package/dist/0~62.js +2 -2
- package/dist/{0~588.js → 0~6588.js} +6 -6
- package/dist/{0~907.js → 0~6907.js} +2 -2
- package/dist/{0~923.js → 0~6923.js} +11 -7
- package/dist/{0~973.js → 0~6973.js} +5 -5
- package/dist/{0~583.js → 0~7583.js} +4 -4
- package/dist/{0~426.js → 0~8426.js} +3 -3
- package/dist/0~89.js +26 -13
- package/dist/0~8957.js +149 -0
- package/dist/{0~634.js → 0~9634.js} +6 -6
- package/dist/{157.js → 1157.js} +4 -4
- package/dist/{216.js → 3216.js} +2 -2
- package/dist/{278.js → 3278.js} +2 -2
- package/dist/{397.js → 4397.js} +1 -1
- package/dist/4881.js +3 -0
- package/dist/554.js +26 -21
- package/dist/{734.js → 5734.js} +4 -4
- package/dist/6198.js +3 -0
- package/dist/{913.js → 7913.js} +7 -7
- package/dist/{131.js → 9131.js} +32 -15
- package/dist/globalSetupWorker.js +8 -6
- package/dist/index.d.ts +13 -1
- package/dist/index.js +1 -1
- package/dist/rslib-runtime.js +1 -1
- package/dist/worker.d.ts +13 -1
- package/package.json +5 -5
- package/dist/198.js +0 -4
- package/dist/881.js +0 -4
- /package/dist/{0~681.js → 0~3062.js} +0 -0
- /package/dist/{0~151.js.LICENSE.txt → 0~6151.js.LICENSE.txt} +0 -0
- /package/dist/{0~583.js.LICENSE.txt → 0~7583.js.LICENSE.txt} +0 -0
- /package/dist/{672.js → 1672.js} +0 -0
- /package/dist/{693.js → 5693.js} +0 -0
- /package/dist/{913.js.LICENSE.txt → 7913.js.LICENSE.txt} +0 -0
package/dist/0~62.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
import { checkPkgInstalled } from "./
|
|
4
|
-
import { installGlobal, addDefaultErrorHandler } from "./0~
|
|
3
|
+
import { checkPkgInstalled } from "./7913.js";
|
|
4
|
+
import { installGlobal, addDefaultErrorHandler } from "./0~3062.js";
|
|
5
5
|
const environment = {
|
|
6
6
|
name: 'jsdom',
|
|
7
7
|
async setup (global, { jsdom = {} }) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
|
-
import "./
|
|
5
|
-
import { runRest } from "./
|
|
6
|
-
import { isTTY } from "./
|
|
7
|
-
import { logger_logger } from "./
|
|
4
|
+
import "./5693.js";
|
|
5
|
+
import { runRest } from "./9131.js";
|
|
6
|
+
import { isTTY } from "./1157.js";
|
|
7
|
+
import { logger_logger } from "./3278.js";
|
|
8
8
|
const GLOB_REGEX = /[*?{}[\]()!@+|]/;
|
|
9
9
|
const isGlob = (str)=>GLOB_REGEX.test(str);
|
|
10
10
|
async function createChokidar(pathOrGlobs, root, options) {
|
|
11
|
-
const chokidar = await import("./0~
|
|
11
|
+
const chokidar = await import("./0~7583.js").then((mod)=>({
|
|
12
12
|
watch: mod.watch
|
|
13
13
|
}));
|
|
14
14
|
const watchFiles = new Set();
|
|
@@ -18,7 +18,7 @@ async function createChokidar(pathOrGlobs, root, options) {
|
|
|
18
18
|
return false;
|
|
19
19
|
});
|
|
20
20
|
if (globPatterns.length) {
|
|
21
|
-
const { glob } = await import("./
|
|
21
|
+
const { glob } = await import("./1157.js").then((mod)=>({
|
|
22
22
|
glob: mod.glob
|
|
23
23
|
}));
|
|
24
24
|
const files = await glob(globPatterns, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
import { encode } from "./
|
|
3
|
+
import { encode } from "./4397.js";
|
|
4
4
|
class BitSet {
|
|
5
5
|
constructor(arg){
|
|
6
6
|
this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
|
|
@@ -137,7 +137,7 @@ class Chunk {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
function getBtoa() {
|
|
140
|
-
if (
|
|
140
|
+
if ("u" > typeof globalThis && 'function' == typeof globalThis.btoa) return (str)=>globalThis.btoa(unescape(encodeURIComponent(str)));
|
|
141
141
|
if ('function' == typeof Buffer) return (str)=>Buffer.from(str, 'utf-8').toString('base64');
|
|
142
142
|
return ()=>{
|
|
143
143
|
throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
|
-
import "./
|
|
5
|
-
import { pathToFileURL } from "./
|
|
6
|
-
import { node_vm, interopModule, shouldInterop } from "./0~
|
|
7
|
-
import { posix, logger_logger } from "./
|
|
4
|
+
import "./5693.js";
|
|
5
|
+
import { pathToFileURL } from "./6198.js";
|
|
6
|
+
import { node_vm, interopModule, shouldInterop } from "./0~3346.js";
|
|
7
|
+
import { posix, logger_logger } from "./3278.js";
|
|
8
8
|
const external_node_path_ = __webpack_require__("node:path");
|
|
9
9
|
var loadEsModule_EsmMode = /*#__PURE__*/ function(EsmMode) {
|
|
10
10
|
EsmMode[EsmMode["Unknown"] = 0] = "Unknown";
|
|
@@ -13,10 +13,14 @@ var loadEsModule_EsmMode = /*#__PURE__*/ function(EsmMode) {
|
|
|
13
13
|
return EsmMode;
|
|
14
14
|
}({});
|
|
15
15
|
const isRelativePath = (p)=>/^\.\.?\//.test(p);
|
|
16
|
+
let latestAssetFiles = {};
|
|
17
|
+
const updateLatestAssetFiles = (assetFiles)=>{
|
|
18
|
+
latestAssetFiles = assetFiles;
|
|
19
|
+
};
|
|
16
20
|
const defineRstestDynamicImport = ({ distPath, testPath, assetFiles, interopDefault, returnModule, esmMode })=>async (specifier, importAttributes)=>{
|
|
17
21
|
const currentDirectory = posix.dirname(distPath);
|
|
18
22
|
const joinedPath = isRelativePath(specifier) ? posix.join(currentDirectory, specifier) : specifier;
|
|
19
|
-
const content = assetFiles[joinedPath];
|
|
23
|
+
const content = assetFiles[joinedPath] || latestAssetFiles[joinedPath];
|
|
20
24
|
if (content) try {
|
|
21
25
|
return await loadModule({
|
|
22
26
|
codeContent: content,
|
|
@@ -114,7 +118,7 @@ const loadModule = async ({ codeContent, distPath, testPath, assetFiles, interop
|
|
|
114
118
|
});
|
|
115
119
|
meta.readWasmFile = (wasmPath, callback)=>{
|
|
116
120
|
const joinedPath = isRelativePath(wasmPath.pathname) ? posix.join(posix.dirname(distPath), wasmPath.pathname) : wasmPath.pathname;
|
|
117
|
-
const content = assetFiles[posix.normalize(joinedPath)];
|
|
121
|
+
const content = assetFiles[posix.normalize(joinedPath)] || latestAssetFiles[posix.normalize(joinedPath)];
|
|
118
122
|
if (content) callback(null, Buffer.from(content, 'base64'));
|
|
119
123
|
else callback(new Error(`WASM file ${joinedPath} not found in asset files.`));
|
|
120
124
|
};
|
|
@@ -147,4 +151,4 @@ const loadModule = async ({ codeContent, distPath, testPath, assetFiles, interop
|
|
|
147
151
|
const ns = esm.namespace;
|
|
148
152
|
return ns.default && ns.default instanceof Promise ? ns.default : ns;
|
|
149
153
|
};
|
|
150
|
-
export { asModule, loadEsModule_EsmMode, loadModule };
|
|
154
|
+
export { asModule, loadEsModule_EsmMode, loadModule, updateLatestAssetFiles };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
|
-
import "./
|
|
5
|
-
import { fileURLToPath } from "./
|
|
6
|
-
import { rspack } from "./
|
|
7
|
-
import { getAbsolutePath, formatTestEntryName } from "./
|
|
8
|
-
import { posix } from "./
|
|
4
|
+
import "./5693.js";
|
|
5
|
+
import { fileURLToPath } from "./6198.js";
|
|
6
|
+
import { rspack } from "./9131.js";
|
|
7
|
+
import { getAbsolutePath, formatTestEntryName } from "./1157.js";
|
|
8
|
+
import { posix } from "./3278.js";
|
|
9
9
|
const external_node_fs_ = __webpack_require__("node:fs");
|
|
10
10
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
11
11
|
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/*! For license information please see 0~
|
|
1
|
+
/*! For license information please see 0~7583.js.LICENSE.txt */
|
|
2
2
|
import 'module';
|
|
3
3
|
/*#__PURE__*/ import.meta.url;
|
|
4
4
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
5
5
|
import { lstat, open as promises_open, readdir, realpath as promises_realpath, stat as promises_stat } from "fs/promises";
|
|
6
6
|
import { Readable } from "node:stream";
|
|
7
|
-
import "./
|
|
8
|
-
import { readdir as promises_readdir, lstat as promises_lstat, promises_stat as promises_promises_stat, realpath as external_node_fs_promises_realpath } from "./
|
|
9
|
-
import { EventEmitter } from "./
|
|
7
|
+
import "./5693.js";
|
|
8
|
+
import { readdir as promises_readdir, lstat as promises_lstat, promises_stat as promises_promises_stat, realpath as external_node_fs_promises_realpath } from "./1157.js";
|
|
9
|
+
import { EventEmitter } from "./9131.js";
|
|
10
10
|
const external_node_path_ = __webpack_require__("node:path");
|
|
11
11
|
const EntryTypes = {
|
|
12
12
|
FILE_TYPE: 'files',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
|
-
import "./
|
|
5
|
-
import "./
|
|
6
|
-
import { relative } from "./
|
|
4
|
+
import "./1157.js";
|
|
5
|
+
import "./5693.js";
|
|
6
|
+
import { relative } from "./3278.js";
|
|
7
7
|
const picomatch = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js");
|
|
8
8
|
var picomatch_default = /*#__PURE__*/ __webpack_require__.n(picomatch);
|
|
9
9
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
package/dist/0~89.js
CHANGED
|
@@ -4,13 +4,13 @@ import { __webpack_require__ } from "./rslib-runtime.js";
|
|
|
4
4
|
import node_events from "node:events";
|
|
5
5
|
import { Tinypool } from "tinypool";
|
|
6
6
|
import node_inspector from "node:inspector";
|
|
7
|
-
import "./
|
|
8
|
-
import { node_process, basename, isDebug, dirname, posix, resolve as pathe_M_eThtNZ_resolve, join } from "./
|
|
9
|
-
import { fileURLToPath } from "./
|
|
10
|
-
import { node_v8, createBirpc } from "./
|
|
11
|
-
import { serializableConfig, bgColor, TEMP_RSTEST_OUTPUT_DIR, TEMP_RSTEST_OUTPUT_DIR_GLOB, castArray, ADDITIONAL_NODE_BUILTINS, needFlagExperimentalDetectModule } from "./
|
|
12
|
-
import { isBuiltin } from "./
|
|
13
|
-
import { core_logger, createRsbuild } from "./
|
|
7
|
+
import "./5693.js";
|
|
8
|
+
import { node_process, basename, isDebug, dirname, posix, resolve as pathe_M_eThtNZ_resolve, join } from "./3278.js";
|
|
9
|
+
import { fileURLToPath } from "./6198.js";
|
|
10
|
+
import { node_v8, createBirpc } from "./3216.js";
|
|
11
|
+
import { serializableConfig, bgColor, TEMP_RSTEST_OUTPUT_DIR, TEMP_RSTEST_OUTPUT_DIR_GLOB, castArray, ADDITIONAL_NODE_BUILTINS, needFlagExperimentalDetectModule } from "./1157.js";
|
|
12
|
+
import { isBuiltin } from "./4881.js";
|
|
13
|
+
import { core_logger, createRsbuild } from "./9131.js";
|
|
14
14
|
const DefaultMaxHeapSize = 1073741824;
|
|
15
15
|
function memory_isMemorySufficient(options) {
|
|
16
16
|
const { memoryThreshold = 0.7, maxHeapSize = DefaultMaxHeapSize } = options || {};
|
|
@@ -179,6 +179,7 @@ const createPool = async ({ context, recommendWorkerCount = 1 / 0 })=>{
|
|
|
179
179
|
needFlagExperimentalDetectModule() ? '--experimental-detect-module' : void 0
|
|
180
180
|
].filter(Boolean),
|
|
181
181
|
env: {
|
|
182
|
+
...process.env,
|
|
182
183
|
NODE_ENV: 'test',
|
|
183
184
|
FORCE_COLOR: '1' === process.env.NO_COLOR ? '0' : '1'
|
|
184
185
|
}
|
|
@@ -407,6 +408,11 @@ const require = /*#__PURE__*/ __rstest_shim_module__.createRequire(import.meta.u
|
|
|
407
408
|
const pluginBasic = (context)=>({
|
|
408
409
|
name: 'rstest:basic',
|
|
409
410
|
setup: (api)=>{
|
|
411
|
+
api.modifyBundlerChain((chain)=>{
|
|
412
|
+
chain.optimization.splitChunks({
|
|
413
|
+
chunks: 'all'
|
|
414
|
+
});
|
|
415
|
+
});
|
|
410
416
|
api.modifyEnvironmentConfig(async (config, { mergeEnvironmentConfig, name })=>{
|
|
411
417
|
const { normalizedConfig: { resolve, source, output, tools, performance, dev, testEnvironment }, outputModule, rootPath } = context.projects.find((p)=>p.environmentName === name);
|
|
412
418
|
return mergeEnvironmentConfig(config, {
|
|
@@ -562,6 +568,7 @@ const pluginEntryWatch = ({ isWatch, globTestSourceEntries, setupFiles, globalSe
|
|
|
562
568
|
};
|
|
563
569
|
};
|
|
564
570
|
config.watchOptions ??= {};
|
|
571
|
+
config.watchOptions.aggregateTimeout = 5;
|
|
565
572
|
config.watchOptions.ignored = castArray(config.watchOptions.ignored || []);
|
|
566
573
|
if (0 === config.watchOptions.ignored.length) config.watchOptions.ignored.push('**/.git', '**/node_modules');
|
|
567
574
|
config.watchOptions.ignored.push(TEMP_RSTEST_OUTPUT_DIR_GLOB, context.normalizedConfig.coverage.reportsDirectory, ...Object.values(globalSetupFiles?.[environment.name] || {}), '**/*.snap');
|
|
@@ -753,11 +760,10 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
753
760
|
const pluginCacheControl = (setupFiles)=>({
|
|
754
761
|
name: 'rstest:cache-control',
|
|
755
762
|
setup: (api)=>{
|
|
756
|
-
api.transform({
|
|
763
|
+
if (setupFiles.length) api.transform({
|
|
757
764
|
test: setupFiles
|
|
758
765
|
}, ({ code })=>({
|
|
759
|
-
code:
|
|
760
|
-
${code}
|
|
766
|
+
code: `${code}
|
|
761
767
|
if (global.setupIds && __webpack_module__.id) {
|
|
762
768
|
global.setupIds.push(__webpack_module__.id);
|
|
763
769
|
}
|
|
@@ -835,10 +841,10 @@ const prepareRsbuild = async (context, globTestSourceEntries, setupFiles, global
|
|
|
835
841
|
}
|
|
836
842
|
});
|
|
837
843
|
if (coverage?.enabled && 'list' !== command) {
|
|
838
|
-
const { loadCoverageProvider } = await import("./
|
|
844
|
+
const { loadCoverageProvider } = await import("./5734.js").then((mod)=>({
|
|
839
845
|
loadCoverageProvider: mod.loadCoverageProvider
|
|
840
846
|
}));
|
|
841
|
-
const { pluginCoverageCore } = await import("./0~
|
|
847
|
+
const { pluginCoverageCore } = await import("./0~2255.js").then((mod)=>({
|
|
842
848
|
pluginCoverageCore: mod.pluginCoverageCore
|
|
843
849
|
}));
|
|
844
850
|
const { pluginCoverage } = await loadCoverageProvider(coverage, context.rootPath);
|
|
@@ -962,13 +968,20 @@ const createRsbuildServer = async ({ globTestSourceEntries, setupFiles, globalSe
|
|
|
962
968
|
if (!rspackCompiler) throw new Error('rspackCompiler was not initialized');
|
|
963
969
|
const outputFileSystem = isMultiCompiler(rspackCompiler) ? rspackCompiler.compilers[0].outputFileSystem : rspackCompiler.outputFileSystem;
|
|
964
970
|
if (!outputFileSystem) throw new Error(`Expect outputFileSystem to be defined, but got ${outputFileSystem}`);
|
|
965
|
-
const
|
|
971
|
+
const cachedReadFilePromises = new Map();
|
|
972
|
+
const readFile = async (fileName)=>{
|
|
973
|
+
if (cachedReadFilePromises.has(fileName)) return cachedReadFilePromises.get(fileName);
|
|
974
|
+
const promise = new Promise((resolve, reject)=>{
|
|
966
975
|
outputFileSystem.readFile(fileName, (err, data)=>{
|
|
967
976
|
if (err) reject(err);
|
|
968
977
|
const content = 'string' == typeof data ? data : fileName.endsWith('.wasm') ? data.toString('base64') : data.toString('utf-8');
|
|
969
978
|
resolve(content);
|
|
970
979
|
});
|
|
971
980
|
});
|
|
981
|
+
cachedReadFilePromises.set(fileName, promise);
|
|
982
|
+
promise.finally(()=>cachedReadFilePromises.delete(fileName));
|
|
983
|
+
return promise;
|
|
984
|
+
};
|
|
972
985
|
const buildData = {};
|
|
973
986
|
const getEntryFiles = async (manifest, outputPath)=>{
|
|
974
987
|
const entryFiles = {};
|
package/dist/0~8957.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
import { M, T } from "./0~6151.js";
|
|
4
|
+
const isMockFunction = (fn)=>'function' == typeof fn && '_isMockFunction' in fn && fn._isMockFunction;
|
|
5
|
+
const initSpy = ()=>{
|
|
6
|
+
let callOrder = 0;
|
|
7
|
+
const mocks = new Set();
|
|
8
|
+
const wrapSpy = (obj, methodName, mockFn)=>{
|
|
9
|
+
const spyImpl = M(obj, methodName, mockFn);
|
|
10
|
+
const spyFn = spyImpl;
|
|
11
|
+
let mockImplementationOnce = [];
|
|
12
|
+
let implementation = mockFn;
|
|
13
|
+
let mockName = mockFn?.name;
|
|
14
|
+
const initMockState = ()=>({
|
|
15
|
+
instances: [],
|
|
16
|
+
contexts: [],
|
|
17
|
+
invocationCallOrder: []
|
|
18
|
+
});
|
|
19
|
+
let mockState = initMockState();
|
|
20
|
+
const spyState = T(spyImpl);
|
|
21
|
+
spyFn.getMockName = ()=>mockName || methodName;
|
|
22
|
+
spyFn.mockName = (name)=>{
|
|
23
|
+
mockName = name;
|
|
24
|
+
return spyFn;
|
|
25
|
+
};
|
|
26
|
+
spyFn.getMockImplementation = ()=>mockImplementationOnce.length ? mockImplementationOnce[mockImplementationOnce.length - 1] : implementation;
|
|
27
|
+
function withImplementation(fn, cb) {
|
|
28
|
+
const originalImplementation = implementation;
|
|
29
|
+
const originalMockImplementationOnce = mockImplementationOnce;
|
|
30
|
+
implementation = fn;
|
|
31
|
+
mockImplementationOnce = [];
|
|
32
|
+
spyState.willCall(willCall);
|
|
33
|
+
const reset = ()=>{
|
|
34
|
+
implementation = originalImplementation;
|
|
35
|
+
mockImplementationOnce = originalMockImplementationOnce;
|
|
36
|
+
};
|
|
37
|
+
const result = cb();
|
|
38
|
+
if (result instanceof Promise) return result.then(()=>{
|
|
39
|
+
reset();
|
|
40
|
+
});
|
|
41
|
+
reset();
|
|
42
|
+
}
|
|
43
|
+
spyFn.withImplementation = withImplementation;
|
|
44
|
+
spyFn.mockImplementation = (fn)=>{
|
|
45
|
+
implementation = fn;
|
|
46
|
+
return spyFn;
|
|
47
|
+
};
|
|
48
|
+
spyFn.mockImplementationOnce = (fn)=>{
|
|
49
|
+
mockImplementationOnce.push(fn);
|
|
50
|
+
return spyFn;
|
|
51
|
+
};
|
|
52
|
+
spyFn.mockReturnValue = (value)=>spyFn.mockImplementation(()=>value);
|
|
53
|
+
spyFn.mockReturnValueOnce = (value)=>spyFn.mockImplementationOnce(()=>value);
|
|
54
|
+
spyFn.mockResolvedValue = (value)=>spyFn.mockImplementation(()=>Promise.resolve(value));
|
|
55
|
+
spyFn.mockResolvedValueOnce = (value)=>spyFn.mockImplementationOnce(()=>Promise.resolve(value));
|
|
56
|
+
spyFn.mockRejectedValue = (value)=>spyFn.mockImplementation(()=>Promise.reject(value));
|
|
57
|
+
spyFn.mockRejectedValueOnce = (value)=>spyFn.mockImplementationOnce(()=>Promise.reject(value));
|
|
58
|
+
spyFn.mockReturnThis = ()=>spyFn.mockImplementation(function() {
|
|
59
|
+
return this;
|
|
60
|
+
});
|
|
61
|
+
function willCall(...args) {
|
|
62
|
+
let impl = implementation || spyState.getOriginal();
|
|
63
|
+
mockState.instances.push(this);
|
|
64
|
+
mockState.contexts.push(this);
|
|
65
|
+
mockState.invocationCallOrder.push(++callOrder);
|
|
66
|
+
if (mockImplementationOnce.length) impl = mockImplementationOnce.shift();
|
|
67
|
+
return impl?.apply(this, args);
|
|
68
|
+
}
|
|
69
|
+
spyState.willCall(willCall);
|
|
70
|
+
Object.defineProperty(spyFn, 'mock', {
|
|
71
|
+
get: ()=>({
|
|
72
|
+
get calls () {
|
|
73
|
+
return spyState.calls;
|
|
74
|
+
},
|
|
75
|
+
get lastCall () {
|
|
76
|
+
return spyState.calls[spyState.callCount - 1];
|
|
77
|
+
},
|
|
78
|
+
get instances () {
|
|
79
|
+
return mockState.instances;
|
|
80
|
+
},
|
|
81
|
+
get contexts () {
|
|
82
|
+
return mockState.contexts;
|
|
83
|
+
},
|
|
84
|
+
get invocationCallOrder () {
|
|
85
|
+
return mockState.invocationCallOrder;
|
|
86
|
+
},
|
|
87
|
+
get results () {
|
|
88
|
+
return spyState.results.map(([resultType, value])=>{
|
|
89
|
+
const type = 'error' === resultType ? 'throw' : 'return';
|
|
90
|
+
return {
|
|
91
|
+
type: type,
|
|
92
|
+
value
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
get settledResults () {
|
|
97
|
+
return spyState.resolves.map(([resultType, value])=>{
|
|
98
|
+
const type = 'error' === resultType ? 'rejected' : 'fulfilled';
|
|
99
|
+
return {
|
|
100
|
+
type,
|
|
101
|
+
value
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
spyFn.mockClear = ()=>{
|
|
108
|
+
mockState = initMockState();
|
|
109
|
+
spyState.reset();
|
|
110
|
+
return spyFn;
|
|
111
|
+
};
|
|
112
|
+
spyFn.mockReset = ()=>{
|
|
113
|
+
spyFn.mockClear();
|
|
114
|
+
implementation = mockFn;
|
|
115
|
+
mockImplementationOnce = [];
|
|
116
|
+
return spyFn;
|
|
117
|
+
};
|
|
118
|
+
spyFn.mockRestore = ()=>{
|
|
119
|
+
spyFn.mockReset();
|
|
120
|
+
spyState.restore();
|
|
121
|
+
mockName = mockFn?.name;
|
|
122
|
+
};
|
|
123
|
+
mocks.add(spyFn);
|
|
124
|
+
return spyFn;
|
|
125
|
+
};
|
|
126
|
+
const fn = (mockFn)=>{
|
|
127
|
+
const defaultName = 'rstest.fn()';
|
|
128
|
+
return wrapSpy({
|
|
129
|
+
[defaultName]: mockFn
|
|
130
|
+
}, defaultName, mockFn);
|
|
131
|
+
};
|
|
132
|
+
const spyOn = (obj, methodName, accessType)=>{
|
|
133
|
+
const accessTypeMap = {
|
|
134
|
+
get: 'getter',
|
|
135
|
+
set: 'setter'
|
|
136
|
+
};
|
|
137
|
+
const method = accessType ? {
|
|
138
|
+
[accessTypeMap[accessType]]: methodName
|
|
139
|
+
} : methodName;
|
|
140
|
+
return wrapSpy(obj, method);
|
|
141
|
+
};
|
|
142
|
+
return {
|
|
143
|
+
isMockFunction: isMockFunction,
|
|
144
|
+
spyOn,
|
|
145
|
+
fn,
|
|
146
|
+
mocks
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
export { initSpy };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
|
-
import "./
|
|
4
|
+
import "./5693.js";
|
|
5
5
|
import { prepareRsbuild, createPool, createRsbuildServer, runGlobalTeardown, runGlobalSetup } from "./0~89.js";
|
|
6
|
-
import { getTestEntries, getTaskNameWithPrefix, prettyTestPath, ROOT_SUITE_NAME, bgColor } from "./
|
|
7
|
-
import { logger_logger } from "./
|
|
6
|
+
import { getTestEntries, getTaskNameWithPrefix, prettyTestPath, ROOT_SUITE_NAME, bgColor } from "./1157.js";
|
|
7
|
+
import { logger_logger } from "./3278.js";
|
|
8
8
|
const external_node_fs_ = __webpack_require__("node:fs");
|
|
9
9
|
const external_node_path_ = __webpack_require__("node:path");
|
|
10
10
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
11
11
|
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
12
12
|
const collectTests = async ({ context, globTestSourceEntries })=>{
|
|
13
|
-
const { getSetupFiles } = await import("./0~
|
|
13
|
+
const { getSetupFiles } = await import("./0~6973.js").then((mod)=>({
|
|
14
14
|
getSetupFiles: mod.getSetupFiles
|
|
15
15
|
}));
|
|
16
16
|
const setupFiles = Object.fromEntries(context.projects.map((project)=>{
|
|
@@ -156,7 +156,7 @@ async function listTests(context, { filesOnly, json, printLocation, includeSuite
|
|
|
156
156
|
const hasError = list.some((file)=>file.errors?.length) || errors.length;
|
|
157
157
|
const showProject = context.projects.length > 1;
|
|
158
158
|
if (hasError) {
|
|
159
|
-
const { printError } = await import("./
|
|
159
|
+
const { printError } = await import("./9131.js").then((mod)=>({
|
|
160
160
|
printError: mod.error_printError
|
|
161
161
|
}));
|
|
162
162
|
process.exitCode = 1;
|
|
@@ -171,7 +171,7 @@ async function listTests(context, { filesOnly, json, printLocation, includeSuite
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
if (errors.length) {
|
|
174
|
-
const { printError } = await import("./
|
|
174
|
+
const { printError } = await import("./9131.js").then((mod)=>({
|
|
175
175
|
printError: mod.error_printError
|
|
176
176
|
}));
|
|
177
177
|
for (const error of errors || []){
|
package/dist/{157.js → 1157.js}
RENAMED
|
@@ -4,8 +4,8 @@ import { __webpack_require__ } from "./rslib-runtime.js";
|
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
import { createRequire } from "module";
|
|
6
6
|
import promises, { lstat, readdir, realpath, stat as promises_stat, writeFile } from "node:fs/promises";
|
|
7
|
-
import "./
|
|
8
|
-
import { normalize, isAbsolute, posix, join, parse } from "./
|
|
7
|
+
import "./5693.js";
|
|
8
|
+
import { normalize, isAbsolute, posix, join, parse } from "./3278.js";
|
|
9
9
|
__webpack_require__.add({
|
|
10
10
|
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
11
11
|
const pico = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js");
|
|
@@ -1377,11 +1377,11 @@ __webpack_require__.add({
|
|
|
1377
1377
|
exports.escapeRegex = (str)=>str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
|
1378
1378
|
exports.toPosixSlashes = (str)=>str.replace(REGEX_BACKSLASH, '/');
|
|
1379
1379
|
exports.isWindows = ()=>{
|
|
1380
|
-
if (
|
|
1380
|
+
if ("u" > typeof navigator && navigator.platform) {
|
|
1381
1381
|
const platform = navigator.platform.toLowerCase();
|
|
1382
1382
|
return 'win32' === platform || 'windows' === platform;
|
|
1383
1383
|
}
|
|
1384
|
-
if (
|
|
1384
|
+
if ("u" > typeof process && process.platform) return 'win32' === process.platform;
|
|
1385
1385
|
return false;
|
|
1386
1386
|
};
|
|
1387
1387
|
exports.removeBackslashes = (str)=>str.replace(REGEX_REMOVE_BACKSLASH, (match)=>'\\' === match ? '' : match);
|
package/dist/{216.js → 3216.js}
RENAMED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
import node_v8 from "node:v8";
|
|
4
3
|
const TYPE_REQUEST = "q";
|
|
5
4
|
const TYPE_RESPONSE = "s";
|
|
6
5
|
const DEFAULT_TIMEOUT = 6e4;
|
|
@@ -206,4 +205,5 @@ function nanoid(size = 21) {
|
|
|
206
205
|
while(i--)id += urlAlphabet[64 * random() | 0];
|
|
207
206
|
return id;
|
|
208
207
|
}
|
|
209
|
-
export {
|
|
208
|
+
export { default as node_v8 } from "node:v8";
|
|
209
|
+
export { createBirpc };
|
package/dist/{278.js → 3278.js}
RENAMED
|
@@ -2,7 +2,7 @@ import 'module';
|
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
4
|
import node_process from "node:process";
|
|
5
|
-
import "./
|
|
5
|
+
import "./5693.js";
|
|
6
6
|
const external_node_os_ = __webpack_require__("node:os");
|
|
7
7
|
const external_node_tty_ = __webpack_require__("node:tty");
|
|
8
8
|
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : node_process.argv) {
|
|
@@ -595,7 +595,7 @@ const join = function(...segments) {
|
|
|
595
595
|
return normalize(path);
|
|
596
596
|
};
|
|
597
597
|
function cwd() {
|
|
598
|
-
if ("
|
|
598
|
+
if ("u" > typeof process && "function" == typeof process.cwd) return process.cwd().replace(/\\/g, "/");
|
|
599
599
|
return "/";
|
|
600
600
|
}
|
|
601
601
|
const resolve = function(...arguments_) {
|
package/dist/{397.js → 4397.js}
RENAMED
|
@@ -41,7 +41,7 @@ function hasMoreVlq(reader, max) {
|
|
|
41
41
|
return reader.peek() !== comma;
|
|
42
42
|
}
|
|
43
43
|
var bufLength = 16384;
|
|
44
|
-
var td = "
|
|
44
|
+
var td = "u" > typeof TextDecoder ? /* @__PURE__ */ new TextDecoder() : "u" > typeof Buffer ? {
|
|
45
45
|
decode (buf) {
|
|
46
46
|
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
47
47
|
return out.toString();
|
package/dist/4881.js
ADDED
package/dist/554.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import __rslib_shim_module__ from 'module';
|
|
2
2
|
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
|
|
3
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
|
-
import "./
|
|
5
|
-
import { formatTestError, setRealTimers, getRealTimers } from "./
|
|
6
|
-
import { node_v8, createBirpc } from "./
|
|
7
|
-
import { basename, isAbsolute, dirname, resolve as pathe_M_eThtNZ_resolve, join } from "./
|
|
8
|
-
import { createCoverageProvider } from "./
|
|
9
|
-
import { undoSerializableConfig, globalApis } from "./
|
|
4
|
+
import "./5693.js";
|
|
5
|
+
import { formatTestError, setRealTimers, getRealTimers } from "./7913.js";
|
|
6
|
+
import { node_v8, createBirpc } from "./3216.js";
|
|
7
|
+
import { basename, isAbsolute, dirname, resolve as pathe_M_eThtNZ_resolve, join } from "./3278.js";
|
|
8
|
+
import { createCoverageProvider } from "./5734.js";
|
|
9
|
+
import { undoSerializableConfig, globalApis } from "./1157.js";
|
|
10
10
|
__webpack_require__.add({
|
|
11
11
|
timers (module) {
|
|
12
12
|
module.exports = require("timers");
|
|
@@ -173,7 +173,7 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, updateSnapshot,
|
|
|
173
173
|
testPath,
|
|
174
174
|
environment: 'node'
|
|
175
175
|
};
|
|
176
|
-
const { createRstestRuntime } = await import("./0~
|
|
176
|
+
const { createRstestRuntime } = await import("./0~6151.js").then((mod)=>({
|
|
177
177
|
createRstestRuntime: mod.createRstestRuntime
|
|
178
178
|
}));
|
|
179
179
|
listeners.forEach((fn)=>{
|
|
@@ -200,7 +200,7 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, updateSnapshot,
|
|
|
200
200
|
process.off('uncaughtException', uncaughtException);
|
|
201
201
|
process.off('unhandledRejection', unhandledRejection);
|
|
202
202
|
});
|
|
203
|
-
const { api, runner } = createRstestRuntime(workerState);
|
|
203
|
+
const { api, runner } = await createRstestRuntime(workerState);
|
|
204
204
|
switch(testEnvironment){
|
|
205
205
|
case 'node':
|
|
206
206
|
break;
|
|
@@ -215,7 +215,7 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, updateSnapshot,
|
|
|
215
215
|
}
|
|
216
216
|
case 'happy-dom':
|
|
217
217
|
{
|
|
218
|
-
const { environment } = await import("./0~
|
|
218
|
+
const { environment } = await import("./0~4809.js").then((mod)=>({
|
|
219
219
|
environment: mod.environment
|
|
220
220
|
}));
|
|
221
221
|
const { teardown } = await environment.setup(global, {});
|
|
@@ -245,24 +245,29 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, updateSnapshot,
|
|
|
245
245
|
};
|
|
246
246
|
};
|
|
247
247
|
const loadFiles = async ({ setupEntries, assetFiles, rstestContext, distPath, testPath, interopDefault, isolate, outputModule })=>{
|
|
248
|
-
const { loadModule } = outputModule ? await import("./0~
|
|
248
|
+
const { loadModule, updateLatestAssetFiles } = outputModule ? await import("./0~6923.js").then((mod)=>({
|
|
249
249
|
EsmMode: mod.loadEsModule_EsmMode,
|
|
250
250
|
asModule: mod.asModule,
|
|
251
|
-
loadModule: mod.loadModule
|
|
252
|
-
|
|
251
|
+
loadModule: mod.loadModule,
|
|
252
|
+
updateLatestAssetFiles: mod.updateLatestAssetFiles
|
|
253
|
+
})) : await import("./0~5835.js").then((mod)=>({
|
|
253
254
|
cacheableLoadModule: mod.cacheableLoadModule,
|
|
254
|
-
loadModule: mod.loadModule
|
|
255
|
+
loadModule: mod.loadModule,
|
|
256
|
+
updateLatestAssetFiles: mod.updateLatestAssetFiles
|
|
255
257
|
}));
|
|
256
|
-
if (!isolate)
|
|
257
|
-
|
|
258
|
+
if (!isolate) {
|
|
259
|
+
updateLatestAssetFiles(assetFiles);
|
|
260
|
+
await loadModule({
|
|
261
|
+
codeContent: `if (global && typeof global.__rstest_clean_core_cache__ === 'function') {
|
|
258
262
|
global.__rstest_clean_core_cache__();
|
|
259
263
|
}`,
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
distPath: '',
|
|
265
|
+
testPath,
|
|
266
|
+
rstestContext,
|
|
267
|
+
assetFiles,
|
|
268
|
+
interopDefault
|
|
269
|
+
});
|
|
270
|
+
}
|
|
266
271
|
for (const { distPath, testPath } of setupEntries){
|
|
267
272
|
const setupCodeContent = assetFiles[distPath];
|
|
268
273
|
await loadModule({
|
package/dist/{734.js → 5734.js}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
|
-
import "./
|
|
5
|
-
import { createRequire } from "./
|
|
6
|
-
import { pathToFileURL } from "./
|
|
7
|
-
import "./
|
|
4
|
+
import "./5693.js";
|
|
5
|
+
import { createRequire } from "./4881.js";
|
|
6
|
+
import { pathToFileURL } from "./6198.js";
|
|
7
|
+
import "./1157.js";
|
|
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);
|
|
10
10
|
const CoverageProviderMap = {
|
package/dist/6198.js
ADDED