@rstest/core 0.8.4 → 0.8.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/dist/0~1472.js +1 -1
- package/dist/0~5835.js +1 -1
- package/dist/0~6588.js +1 -1
- package/dist/0~6923.js +1 -1
- package/dist/0~7583.js +1 -1
- package/dist/0~7882.js +3 -3
- package/dist/0~89.js +13 -9
- package/dist/0~9634.js +1 -1
- package/dist/1157.js +1 -1
- package/dist/3160.js +1 -1
- package/dist/487.js +1 -1
- package/dist/{9869.js → 5960.js} +33 -43
- package/dist/9131.js +5 -5
- package/dist/mockRuntimeCode.js +15 -4
- package/dist/worker.js +5 -28
- package/package.json +2 -2
package/dist/0~1472.js
CHANGED
|
@@ -4,7 +4,7 @@ import { pathToFileURL } from "./6198.js";
|
|
|
4
4
|
import "./1157.js";
|
|
5
5
|
import { logger as logger_logger, color } from "./3160.js";
|
|
6
6
|
async function loadBrowserModule(options = {}) {
|
|
7
|
-
const coreVersion = "0.8.
|
|
7
|
+
const coreVersion = "0.8.5";
|
|
8
8
|
const { projectRoots = [] } = options;
|
|
9
9
|
let browserModule;
|
|
10
10
|
let browserVersion;
|
package/dist/0~5835.js
CHANGED
|
@@ -5,7 +5,7 @@ import { createRequire as external_node_module_createRequire } from "./4881.js";
|
|
|
5
5
|
import { pathToFileURL } from "./6198.js";
|
|
6
6
|
import { node_vm, asModule, shouldInterop, interopModule } from "./0~3346.js";
|
|
7
7
|
import { posix } from "./7011.js";
|
|
8
|
-
const external_node_path_ = __webpack_require__("
|
|
8
|
+
const external_node_path_ = __webpack_require__("path");
|
|
9
9
|
const isRelativePath = (p)=>/^\.\.?\//.test(p);
|
|
10
10
|
const createRequire = (filename, distPath, rstestContext, assetFiles, interopDefault)=>{
|
|
11
11
|
const _require = (()=>{
|
package/dist/0~6588.js
CHANGED
|
@@ -27,7 +27,7 @@ async function createChokidar(pathOrGlobs, root, options) {
|
|
|
27
27
|
}
|
|
28
28
|
return chokidar.watch(Array.from(watchFiles), options);
|
|
29
29
|
}
|
|
30
|
-
const external_node_path_ = __webpack_require__("
|
|
30
|
+
const external_node_path_ = __webpack_require__("path");
|
|
31
31
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
32
32
|
let cleaners = [];
|
|
33
33
|
const onBeforeRestart = (cleaner)=>{
|
package/dist/0~6923.js
CHANGED
|
@@ -4,7 +4,7 @@ import { logger as logger_logger } from "./3160.js";
|
|
|
4
4
|
import { pathToFileURL } from "./6198.js";
|
|
5
5
|
import { node_vm, interopModule, shouldInterop } from "./0~3346.js";
|
|
6
6
|
import { posix } from "./7011.js";
|
|
7
|
-
const external_node_path_ = __webpack_require__("
|
|
7
|
+
const external_node_path_ = __webpack_require__("path");
|
|
8
8
|
var loadEsModule_EsmMode = /*#__PURE__*/ function(EsmMode) {
|
|
9
9
|
EsmMode[EsmMode["Unknown"] = 0] = "Unknown";
|
|
10
10
|
EsmMode[EsmMode["Evaluated"] = 1] = "Evaluated";
|
package/dist/0~7583.js
CHANGED
|
@@ -6,7 +6,7 @@ import "./3160.js";
|
|
|
6
6
|
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";
|
|
7
7
|
import { Readable } from "./0~1981.js";
|
|
8
8
|
import { EventEmitter } from "./9131.js";
|
|
9
|
-
const external_node_path_ = __webpack_require__("
|
|
9
|
+
const external_node_path_ = __webpack_require__("path");
|
|
10
10
|
const EntryTypes = {
|
|
11
11
|
FILE_TYPE: 'files',
|
|
12
12
|
DIR_TYPE: 'directories',
|
package/dist/0~7882.js
CHANGED
|
@@ -5,7 +5,7 @@ import { detect, resolveCommand } from "./9131.js";
|
|
|
5
5
|
import { Ie, Me, ye, M, dist_Y, Se, ve, pD, xe } from "./0~9348.js";
|
|
6
6
|
import "./1157.js";
|
|
7
7
|
const external_node_fs_ = __webpack_require__("node:fs");
|
|
8
|
-
const external_node_path_ = __webpack_require__("
|
|
8
|
+
const external_node_path_ = __webpack_require__("path");
|
|
9
9
|
function getUniqueBaseName(dir, baseName, ext) {
|
|
10
10
|
const fullPath = external_node_path_["default"].join(dir, `${baseName}${ext}`);
|
|
11
11
|
if (!external_node_fs_["default"].existsSync(fullPath)) return baseName;
|
|
@@ -372,7 +372,7 @@ async function createInteractive(cwd, projectInfo, isAgent) {
|
|
|
372
372
|
}
|
|
373
373
|
const provider = providerSelection;
|
|
374
374
|
const preview = computeFilePreview(cwd, projectInfo);
|
|
375
|
-
const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.8.
|
|
375
|
+
const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.8.5");
|
|
376
376
|
const depsList = Object.entries(deps).map(([name, version])=>`${name}@${version}`).join(', ');
|
|
377
377
|
const previewLines = [
|
|
378
378
|
`${color.cyan('+')} Create ${preview.configFile}`,
|
|
@@ -450,7 +450,7 @@ async function generateFiles(cwd, projectInfo, provider) {
|
|
|
450
450
|
updatePackageJsonScripts(cwd, {
|
|
451
451
|
'test:browser': 'rstest --config=rstest.browser.config.ts'
|
|
452
452
|
});
|
|
453
|
-
const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.8.
|
|
453
|
+
const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.8.5");
|
|
454
454
|
updatePackageJsonDevDeps(cwd, deps);
|
|
455
455
|
return createdFiles;
|
|
456
456
|
}
|
package/dist/0~89.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Tinypool } from "tinypool";
|
|
|
5
5
|
import node_inspector from "node:inspector";
|
|
6
6
|
import { basename, needFlagExperimentalDetectModule, isDeno, dirname, castArray, resolve as pathe_M_eThtNZ_resolve, serializableConfig, node_process, isDebug, color, getForceColorEnv, ADDITIONAL_NODE_BUILTINS, bgColor, join } from "./3160.js";
|
|
7
7
|
import { fileURLToPath } from "./6198.js";
|
|
8
|
-
import { node_v8, parseWorkerMetaMessage, createBirpc } from "./
|
|
8
|
+
import { node_v8, parseWorkerMetaMessage, createBirpc } from "./5960.js";
|
|
9
9
|
import { TEMP_RSTEST_OUTPUT_DIR, TEMP_RSTEST_OUTPUT_DIR_GLOB } from "./1157.js";
|
|
10
10
|
import { posix } from "./7011.js";
|
|
11
11
|
import { isBuiltin } from "./4881.js";
|
|
@@ -198,9 +198,8 @@ const createWorkerStderrCapture = (pool)=>{
|
|
|
198
198
|
};
|
|
199
199
|
const forks_filename = fileURLToPath(import.meta.url);
|
|
200
200
|
const forks_dirname = dirname(forks_filename);
|
|
201
|
-
function
|
|
201
|
+
function createForksChannel(rpcMethods, onWorkerMeta, createBirpcImpl = createBirpc) {
|
|
202
202
|
const emitter = new node_events();
|
|
203
|
-
const cleanup = ()=>emitter.removeAllListeners();
|
|
204
203
|
const events = {
|
|
205
204
|
message: 'message',
|
|
206
205
|
response: 'response'
|
|
@@ -215,9 +214,10 @@ function createChannel(rpcMethods, onWorkerMeta) {
|
|
|
215
214
|
emitter.emit(events.response, message);
|
|
216
215
|
}
|
|
217
216
|
};
|
|
218
|
-
|
|
217
|
+
const rpc = createBirpcImpl(rpcMethods, {
|
|
219
218
|
serialize: node_v8.serialize,
|
|
220
219
|
deserialize: (v)=>node_v8.deserialize(Buffer.from(v)),
|
|
220
|
+
timeout: -1,
|
|
221
221
|
post (v) {
|
|
222
222
|
emitter.emit(events.message, v);
|
|
223
223
|
},
|
|
@@ -225,9 +225,13 @@ function createChannel(rpcMethods, onWorkerMeta) {
|
|
|
225
225
|
emitter.on(events.response, fn);
|
|
226
226
|
}
|
|
227
227
|
});
|
|
228
|
+
const cleanup = ()=>{
|
|
229
|
+
rpc.$close(new Error('[rstest-pool]: Pending methods while closing rpc'));
|
|
230
|
+
emitter.removeAllListeners();
|
|
231
|
+
};
|
|
228
232
|
return {
|
|
229
|
-
channel,
|
|
230
|
-
cleanup
|
|
233
|
+
channel: channel,
|
|
234
|
+
cleanup: cleanup
|
|
231
235
|
};
|
|
232
236
|
}
|
|
233
237
|
const createForksPool = (poolOptions)=>{
|
|
@@ -250,7 +254,7 @@ const createForksPool = (poolOptions)=>{
|
|
|
250
254
|
runTest: async ({ options, rpcMethods })=>{
|
|
251
255
|
const taskId = ++nextTaskId;
|
|
252
256
|
stderrCapture.createTask(taskId);
|
|
253
|
-
const { channel, cleanup } =
|
|
257
|
+
const { channel, cleanup } = createForksChannel(rpcMethods, ({ pid })=>{
|
|
254
258
|
stderrCapture.bindTaskToPid(taskId, pid);
|
|
255
259
|
});
|
|
256
260
|
try {
|
|
@@ -268,7 +272,7 @@ const createForksPool = (poolOptions)=>{
|
|
|
268
272
|
collectTests: async ({ options, rpcMethods })=>{
|
|
269
273
|
const taskId = ++nextTaskId;
|
|
270
274
|
stderrCapture.createTask(taskId);
|
|
271
|
-
const { channel, cleanup } =
|
|
275
|
+
const { channel, cleanup } = createForksChannel(rpcMethods, ({ pid })=>{
|
|
272
276
|
stderrCapture.bindTaskToPid(taskId, pid);
|
|
273
277
|
});
|
|
274
278
|
try {
|
|
@@ -597,7 +601,7 @@ async function runGlobalTeardown() {
|
|
|
597
601
|
process.exitCode = 1;
|
|
598
602
|
}
|
|
599
603
|
}
|
|
600
|
-
const external_node_path_ = __webpack_require__("
|
|
604
|
+
const external_node_path_ = __webpack_require__("path");
|
|
601
605
|
const RUNTIME_CHUNK_NAME = 'runtime';
|
|
602
606
|
const requireShim = `// Rstest ESM shims
|
|
603
607
|
import __rstest_shim_module__ from 'node:module';
|
package/dist/0~9634.js
CHANGED
|
@@ -4,7 +4,7 @@ import { logger as logger_logger, getTaskNameWithPrefix, color, bgColor } from "
|
|
|
4
4
|
import { prepareRsbuild, createPool, createRsbuildServer, runGlobalTeardown, runGlobalSetup } from "./0~89.js";
|
|
5
5
|
import { getTestEntries, resolveShardedEntries, prettyTestPath, ROOT_SUITE_NAME } from "./1157.js";
|
|
6
6
|
const external_node_fs_ = __webpack_require__("node:fs");
|
|
7
|
-
const external_node_path_ = __webpack_require__("
|
|
7
|
+
const external_node_path_ = __webpack_require__("path");
|
|
8
8
|
const collectNodeTests = async ({ context, nodeProjects, globTestSourceEntries })=>{
|
|
9
9
|
const { getSetupFiles } = await import("./6973.js").then((mod)=>({
|
|
10
10
|
getSetupFiles: mod.getSetupFiles
|
package/dist/1157.js
CHANGED
|
@@ -1441,7 +1441,7 @@ const globalApis = [
|
|
|
1441
1441
|
'onTestFailed'
|
|
1442
1442
|
];
|
|
1443
1443
|
const TS_CONFIG_FILE = 'tsconfig.json';
|
|
1444
|
-
const external_node_path_ = __webpack_require__("
|
|
1444
|
+
const external_node_path_ = __webpack_require__("path");
|
|
1445
1445
|
const external_node_fs_ = __webpack_require__("node:fs");
|
|
1446
1446
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
1447
1447
|
function cleanPath(path) {
|
package/dist/3160.js
CHANGED
package/dist/487.js
CHANGED
|
@@ -35,7 +35,7 @@ __webpack_require__.add({
|
|
|
35
35
|
"../../node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js" (module, exports, __webpack_require__) {
|
|
36
36
|
module = __webpack_require__.nmd(module);
|
|
37
37
|
var SourceMapConsumer = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/source-map.js").SourceMapConsumer;
|
|
38
|
-
var path = __webpack_require__("
|
|
38
|
+
var path = __webpack_require__("path");
|
|
39
39
|
var fs;
|
|
40
40
|
try {
|
|
41
41
|
fs = __webpack_require__("node:fs");
|
package/dist/{9869.js → 5960.js}
RENAMED
|
@@ -19,15 +19,32 @@ const parseWorkerMetaMessage = (message)=>{
|
|
|
19
19
|
};
|
|
20
20
|
const TYPE_REQUEST = "q";
|
|
21
21
|
const TYPE_RESPONSE = "s";
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
function createPromiseWithResolvers() {
|
|
23
|
+
let resolve;
|
|
24
|
+
let reject;
|
|
25
|
+
return {
|
|
26
|
+
promise: new Promise((res, rej)=>{
|
|
27
|
+
resolve = res;
|
|
28
|
+
reject = rej;
|
|
29
|
+
}),
|
|
30
|
+
resolve,
|
|
31
|
+
reject
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const random = Math.random.bind(Math);
|
|
35
|
+
const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
36
|
+
function nanoid(size = 21) {
|
|
37
|
+
let id = "";
|
|
38
|
+
let i = size;
|
|
39
|
+
while(i--)id += urlAlphabet[64 * random() | 0];
|
|
40
|
+
return id;
|
|
25
41
|
}
|
|
42
|
+
const DEFAULT_TIMEOUT = 6e4;
|
|
43
|
+
const defaultSerialize = (i)=>i;
|
|
26
44
|
const defaultDeserialize = defaultSerialize;
|
|
27
45
|
const { clearTimeout: dist_clearTimeout, setTimeout: dist_setTimeout } = globalThis;
|
|
28
|
-
const random = Math.random.bind(Math);
|
|
29
46
|
function createBirpc($functions, options) {
|
|
30
|
-
const { post, on, off = ()=>{}, eventNames = [], serialize = defaultSerialize, deserialize = defaultDeserialize, resolver, bind = "rpc", timeout = DEFAULT_TIMEOUT } = options;
|
|
47
|
+
const { post, on, off = ()=>{}, eventNames = [], serialize = defaultSerialize, deserialize = defaultDeserialize, resolver, bind = "rpc", timeout = DEFAULT_TIMEOUT, proxify = true } = options;
|
|
31
48
|
let $closed = false;
|
|
32
49
|
const _rpcPromiseMap = /* @__PURE__ */ new Map();
|
|
33
50
|
let _promiseInit;
|
|
@@ -55,8 +72,7 @@ function createBirpc($functions, options) {
|
|
|
55
72
|
if (timeout >= 0) {
|
|
56
73
|
timeoutId = dist_setTimeout(()=>{
|
|
57
74
|
try {
|
|
58
|
-
|
|
59
|
-
if (true !== handleResult) throw new Error(`[birpc] timeout on calling "${method}"`);
|
|
75
|
+
if (options.onTimeoutError?.call(rpc, method, args) !== true) throw new Error(`[birpc] timeout on calling "${method}"`);
|
|
60
76
|
} catch (e) {
|
|
61
77
|
reject(e);
|
|
62
78
|
}
|
|
@@ -85,15 +101,11 @@ function createBirpc($functions, options) {
|
|
|
85
101
|
}
|
|
86
102
|
return promise;
|
|
87
103
|
}
|
|
88
|
-
const $call = (method, ...args)=>_call(method, args, false);
|
|
89
|
-
const $callOptional = (method, ...args)=>_call(method, args, false, true);
|
|
90
|
-
const $callEvent = (method, ...args)=>_call(method, args, true);
|
|
91
|
-
const $callRaw = (options2)=>_call(options2.method, options2.args, options2.event, options2.optional);
|
|
92
104
|
const builtinMethods = {
|
|
93
|
-
$call,
|
|
94
|
-
$callOptional,
|
|
95
|
-
$callEvent,
|
|
96
|
-
$callRaw,
|
|
105
|
+
$call: (method, ...args)=>_call(method, args, false),
|
|
106
|
+
$callOptional: (method, ...args)=>_call(method, args, false, true),
|
|
107
|
+
$callEvent: (method, ...args)=>_call(method, args, true),
|
|
108
|
+
$callRaw: (options$1)=>_call(options$1.method, options$1.args, options$1.event, options$1.optional),
|
|
97
109
|
$rejectPendingCalls,
|
|
98
110
|
get $closed () {
|
|
99
111
|
return $closed;
|
|
@@ -104,7 +116,7 @@ function createBirpc($functions, options) {
|
|
|
104
116
|
$close,
|
|
105
117
|
$functions
|
|
106
118
|
};
|
|
107
|
-
rpc = new Proxy({}, {
|
|
119
|
+
rpc = proxify ? new Proxy({}, {
|
|
108
120
|
get (_, method) {
|
|
109
121
|
if (Object.prototype.hasOwnProperty.call(builtinMethods, method)) return builtinMethods[method];
|
|
110
122
|
if ("then" === method && !eventNames.includes("then") && !("then" in $functions)) return;
|
|
@@ -117,11 +129,11 @@ function createBirpc($functions, options) {
|
|
|
117
129
|
sendCall.asEvent = sendEvent;
|
|
118
130
|
return sendCall;
|
|
119
131
|
}
|
|
120
|
-
});
|
|
132
|
+
}) : builtinMethods;
|
|
121
133
|
function $close(customError) {
|
|
122
134
|
$closed = true;
|
|
123
135
|
_rpcPromiseMap.forEach(({ reject, method })=>{
|
|
124
|
-
const error = new Error(`[birpc] rpc is closed, cannot call "${method}"`);
|
|
136
|
+
const error = /* @__PURE__ */ new Error(`[birpc] rpc is closed, cannot call "${method}"`);
|
|
125
137
|
if (customError) {
|
|
126
138
|
customError.cause ??= error;
|
|
127
139
|
return reject(customError);
|
|
@@ -132,9 +144,8 @@ function createBirpc($functions, options) {
|
|
|
132
144
|
off(onMessage);
|
|
133
145
|
}
|
|
134
146
|
function $rejectPendingCalls(handler) {
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
if (!handler) return reject(new Error(`[birpc]: rejected pending call "${method}".`));
|
|
147
|
+
const handlerResults = Array.from(_rpcPromiseMap.values()).map(({ method, reject })=>{
|
|
148
|
+
if (!handler) return reject(/* @__PURE__ */ new Error(`[birpc]: rejected pending call "${method}".`));
|
|
138
149
|
return handler({
|
|
139
150
|
method,
|
|
140
151
|
reject
|
|
@@ -161,9 +172,8 @@ function createBirpc($functions, options) {
|
|
|
161
172
|
} catch (e) {
|
|
162
173
|
error = e;
|
|
163
174
|
}
|
|
164
|
-
else error = new Error(`[birpc] function "${method}" not found`);
|
|
175
|
+
else error = /* @__PURE__ */ new Error(`[birpc] function "${method}" not found`);
|
|
165
176
|
if (msg.i) {
|
|
166
|
-
if (error && options.onError) options.onError.call(rpc, error, method, args);
|
|
167
177
|
if (error && options.onFunctionError) {
|
|
168
178
|
if (true === options.onFunctionError.call(rpc, error, method, args)) return;
|
|
169
179
|
}
|
|
@@ -202,25 +212,5 @@ function createBirpc($functions, options) {
|
|
|
202
212
|
_promiseInit = on(onMessage);
|
|
203
213
|
return rpc;
|
|
204
214
|
}
|
|
205
|
-
function createPromiseWithResolvers() {
|
|
206
|
-
let resolve;
|
|
207
|
-
let reject;
|
|
208
|
-
const promise = new Promise((res, rej)=>{
|
|
209
|
-
resolve = res;
|
|
210
|
-
reject = rej;
|
|
211
|
-
});
|
|
212
|
-
return {
|
|
213
|
-
promise,
|
|
214
|
-
resolve,
|
|
215
|
-
reject
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
219
|
-
function nanoid(size = 21) {
|
|
220
|
-
let id = "";
|
|
221
|
-
let i = size;
|
|
222
|
-
while(i--)id += urlAlphabet[64 * random() | 0];
|
|
223
|
-
return id;
|
|
224
|
-
}
|
|
225
215
|
export { default as node_v8 } from "node:v8";
|
|
226
216
|
export { createBirpc, createWorkerMetaMessage, parseWorkerMetaMessage };
|
package/dist/9131.js
CHANGED
|
@@ -504,7 +504,7 @@ 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.8.
|
|
507
|
+
logger_logger.greet(" Rstest v0.8.5");
|
|
508
508
|
logger_logger.log('');
|
|
509
509
|
}
|
|
510
510
|
const applyCommonOptions = (cli)=>{
|
|
@@ -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.8.
|
|
565
|
+
cli.version("0.8.5");
|
|
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();
|
|
@@ -2191,7 +2191,7 @@ function traceSegmentInternal(segments, memo, line, column, bias) {
|
|
|
2191
2191
|
if (-1 === index || index === segments.length) return -1;
|
|
2192
2192
|
return index;
|
|
2193
2193
|
}
|
|
2194
|
-
const external_node_path_ = __webpack_require__("
|
|
2194
|
+
const external_node_path_ = __webpack_require__("path");
|
|
2195
2195
|
const isRelativePath = (p)=>/^\.\.?\//.test(p);
|
|
2196
2196
|
const hintNotDefinedError = (message)=>{
|
|
2197
2197
|
const [, varName] = message.match(/(\w+) is not defined/) || [];
|
|
@@ -3452,7 +3452,7 @@ class MdReporter {
|
|
|
3452
3452
|
}
|
|
3453
3453
|
renderFrontMatter(lines) {
|
|
3454
3454
|
const frontMatter = {
|
|
3455
|
-
tool: "@rstest/core@0.8.
|
|
3455
|
+
tool: "@rstest/core@0.8.5",
|
|
3456
3456
|
timestamp: new Date().toISOString()
|
|
3457
3457
|
};
|
|
3458
3458
|
if (this.options.header.env) frontMatter.runtime = {
|
|
@@ -3822,7 +3822,7 @@ class Rstest {
|
|
|
3822
3822
|
updateSnapshot: rstestConfig.update ? 'all' : T ? 'none' : 'new'
|
|
3823
3823
|
});
|
|
3824
3824
|
this.snapshotManager = snapshotManager;
|
|
3825
|
-
this.version = "0.8.
|
|
3825
|
+
this.version = "0.8.5";
|
|
3826
3826
|
this.rootPath = rootPath;
|
|
3827
3827
|
this.originalConfig = userConfig;
|
|
3828
3828
|
this.normalizedConfig = rstestConfig;
|
package/dist/mockRuntimeCode.js
CHANGED
|
@@ -40,7 +40,9 @@ __webpack_require__.rstest_require_actual = __webpack_require__.rstest_import_ac
|
|
|
40
40
|
}
|
|
41
41
|
return __webpack_require__(id);
|
|
42
42
|
};
|
|
43
|
-
const getMockImplementation = (mockType = 'mock')=>
|
|
43
|
+
const getMockImplementation = (mockType = 'mock')=>{
|
|
44
|
+
const isMockRequire = 'mockRequire' === mockType || 'doMockRequire' === mockType;
|
|
45
|
+
return (id, modFactory)=>{
|
|
44
46
|
let requiredModule = __webpack_module_cache__[id]?.exports;
|
|
45
47
|
const wasAlreadyLoaded = !!requiredModule;
|
|
46
48
|
if (requiredModule) {
|
|
@@ -66,7 +68,11 @@ const getMockImplementation = (mockType = 'mock')=>(id, modFactory)=>{
|
|
|
66
68
|
const mockedModule = globalThis.RSTEST_API?.rstest?.mockObject(originalModule, {
|
|
67
69
|
spy: isSpy
|
|
68
70
|
}) || originalModule;
|
|
69
|
-
const finalModFactory = function(
|
|
71
|
+
const finalModFactory = function(__webpack_module__, __webpack_exports__, __webpack_require__1) {
|
|
72
|
+
if (isMockRequire) {
|
|
73
|
+
__webpack_module__.exports = mockedModule;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
70
76
|
__webpack_require__1.r(__webpack_exports__);
|
|
71
77
|
for(const key in mockedModule)__webpack_require__1.d(__webpack_exports__, {
|
|
72
78
|
[key]: ()=>mockedModule[key]
|
|
@@ -83,9 +89,13 @@ const getMockImplementation = (mockType = 'mock')=>(id, modFactory)=>{
|
|
|
83
89
|
exports: __webpack_require__(modFactory)
|
|
84
90
|
};
|
|
85
91
|
else if ('function' == typeof modFactory) {
|
|
86
|
-
const finalModFactory = function(
|
|
87
|
-
__webpack_require__1.r(__webpack_exports__);
|
|
92
|
+
const finalModFactory = function(__webpack_module__, __webpack_exports__, __webpack_require__1) {
|
|
88
93
|
const res = modFactory();
|
|
94
|
+
if (isMockRequire) {
|
|
95
|
+
__webpack_module__.exports = res;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
__webpack_require__1.r(__webpack_exports__);
|
|
89
99
|
for(const key in res)__webpack_require__1.d(__webpack_exports__, {
|
|
90
100
|
[key]: ()=>res[key]
|
|
91
101
|
});
|
|
@@ -94,6 +104,7 @@ const getMockImplementation = (mockType = 'mock')=>(id, modFactory)=>{
|
|
|
94
104
|
delete __webpack_module_cache__[id];
|
|
95
105
|
}
|
|
96
106
|
};
|
|
107
|
+
};
|
|
97
108
|
__webpack_require__.rstest_mock = getMockImplementation('mock');
|
|
98
109
|
__webpack_require__.rstest_mock_require = getMockImplementation('mockRequire');
|
|
99
110
|
__webpack_require__.rstest_do_mock = getMockImplementation('doMock');
|
package/dist/worker.js
CHANGED
|
@@ -2,7 +2,7 @@ import "node:module";
|
|
|
2
2
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
3
3
|
import { basename, isAbsolute, undoSerializableConfig, dirname, color, resolve as pathe_M_eThtNZ_resolve, join } from "./3160.js";
|
|
4
4
|
import "./487.js";
|
|
5
|
-
import { node_v8, createWorkerMetaMessage, createBirpc } from "./
|
|
5
|
+
import { node_v8, createWorkerMetaMessage, createBirpc } from "./5960.js";
|
|
6
6
|
import { createCoverageProvider } from "./5734.js";
|
|
7
7
|
import { formatTestError, setRealTimers, getRealTimers } from "./1294.js";
|
|
8
8
|
import { globalApis } from "./1157.js";
|
|
@@ -26,30 +26,10 @@ function createForksRpcOptions({ nodeV8 = node_v8, dispose = [] }) {
|
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
function createRuntimeRpc(options,
|
|
30
|
-
const rpc =
|
|
29
|
+
function createRuntimeRpc(options, createBirpcImpl = createBirpc) {
|
|
30
|
+
const rpc = createBirpcImpl({}, {
|
|
31
31
|
...options,
|
|
32
|
-
|
|
33
|
-
switch(functionName){
|
|
34
|
-
case 'onTestCaseStart':
|
|
35
|
-
{
|
|
36
|
-
const caseTest = error[0];
|
|
37
|
-
console.error(`[Rstest] timeout on calling "onTestCaseStart" rpc method (Case: "${caseTest.name}")`);
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
case 'onTestCaseResult':
|
|
41
|
-
{
|
|
42
|
-
const caseResult = error[0];
|
|
43
|
-
console.error(`[Rstest] timeout on calling "onTestCaseResult" rpc method (Case: "${caseResult.name}", Result: "${caseResult.status}")`);
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
case 'onConsoleLog':
|
|
47
|
-
originalConsole.error(`[Rstest] timeout on calling "onConsoleLog" rpc method (Original log: ${error[0].content})`);
|
|
48
|
-
return true;
|
|
49
|
-
default:
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
32
|
+
timeout: -1
|
|
53
33
|
});
|
|
54
34
|
return {
|
|
55
35
|
rpc
|
|
@@ -135,13 +115,10 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, updateSnapshot,
|
|
|
135
115
|
context.runtimeConfig = undoSerializableConfig(context.runtimeConfig);
|
|
136
116
|
process.env.RSTEST_WORKER_ID = String(process.__tinypool_state__.workerId || context.taskId);
|
|
137
117
|
const cleanupFns = [];
|
|
138
|
-
const originalConsole = global.console;
|
|
139
118
|
const disposeFns = [];
|
|
140
119
|
const { rpc } = createRuntimeRpc(createForksRpcOptions({
|
|
141
120
|
dispose: disposeFns
|
|
142
|
-
})
|
|
143
|
-
originalConsole
|
|
144
|
-
});
|
|
121
|
+
}));
|
|
145
122
|
globalCleanups.push(()=>{
|
|
146
123
|
disposeFns.forEach((fn)=>{
|
|
147
124
|
fn();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rstest/core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.5",
|
|
4
4
|
"description": "The Rsbuild-based test tool.",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rstest/issues"
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@types/source-map-support": "^0.5.10",
|
|
77
77
|
"@vitest/expect": "^3.2.4",
|
|
78
78
|
"@vitest/snapshot": "^3.2.4",
|
|
79
|
-
"birpc": "
|
|
79
|
+
"birpc": "^4.0.0",
|
|
80
80
|
"cac": "^6.7.14",
|
|
81
81
|
"chai": "^5.3.3",
|
|
82
82
|
"chokidar": "^4.0.3",
|