@rstest/core 0.8.2 → 0.8.4

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.
Files changed (52) hide show
  1. package/dist/0~130.js +1 -2
  2. package/dist/0~1472.js +2 -3
  3. package/dist/0~1981.js +1 -2
  4. package/dist/0~2173.js +6 -4
  5. package/dist/0~2255.js +2 -3
  6. package/dist/0~3062.js +1 -2
  7. package/dist/0~3346.js +1 -2
  8. package/dist/0~3919.js +1 -2
  9. package/dist/0~4403.js +1 -2
  10. package/dist/0~4809.js +1 -2
  11. package/dist/0~5835.js +6 -10
  12. package/dist/0~62.js +1 -2
  13. package/dist/0~6588.js +5 -5
  14. package/dist/0~6907.js +1 -2
  15. package/dist/0~6923.js +6 -10
  16. package/dist/0~7583.js +3 -4
  17. package/dist/0~7882.js +7 -8
  18. package/dist/0~8426.js +1 -2
  19. package/dist/0~89.js +212 -15
  20. package/dist/0~9348.js +1 -2
  21. package/dist/0~9634.js +5 -5
  22. package/dist/1157.js +4 -97
  23. package/dist/1294.js +1 -2
  24. package/dist/1672.js +1 -2
  25. package/dist/3160.js +106 -10
  26. package/dist/4397.js +1 -2
  27. package/dist/4484.js +1 -2
  28. package/dist/487.js +3 -4
  29. package/dist/4881.js +1 -2
  30. package/dist/4899.js +2 -2
  31. package/dist/5734.js +1 -2
  32. package/dist/6151.js +9 -2
  33. package/dist/6198.js +1 -2
  34. package/dist/6973.js +2 -3
  35. package/dist/7011.js +1 -2
  36. package/dist/721.js +1 -2
  37. package/dist/9131.js +35 -32
  38. package/dist/{3216.js → 9869.js} +20 -3
  39. package/dist/browser-runtime/389.js +9 -0
  40. package/dist/browser-runtime/389.js.LICENSE.txt +22 -0
  41. package/dist/browser-runtime/index.d.ts +27 -1
  42. package/dist/browser.d.ts +29 -1
  43. package/dist/browser.js +1 -2
  44. package/dist/globalSetupWorker.js +5 -6
  45. package/dist/index.d.ts +27 -1
  46. package/dist/index.js +1 -2
  47. package/dist/mockRuntimeCode.js +63 -174
  48. package/dist/rslib-runtime.js +1 -2
  49. package/dist/worker.d.ts +27 -1
  50. package/dist/worker.js +30 -20
  51. package/package.json +2 -2
  52. /package/dist/{1157.js.LICENSE.txt → 3160.js.LICENSE.txt} +0 -0
package/dist/worker.js CHANGED
@@ -1,9 +1,8 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  import { __webpack_require__ } from "./rslib-runtime.js";
4
3
  import { basename, isAbsolute, undoSerializableConfig, dirname, color, resolve as pathe_M_eThtNZ_resolve, join } from "./3160.js";
5
4
  import "./487.js";
6
- import { node_v8, createBirpc } from "./3216.js";
5
+ import { node_v8, createWorkerMetaMessage, createBirpc } from "./9869.js";
7
6
  import { createCoverageProvider } from "./5734.js";
8
7
  import { formatTestError, setRealTimers, getRealTimers } from "./1294.js";
9
8
  import { globalApis } from "./1157.js";
@@ -56,7 +55,7 @@ function createRuntimeRpc(options, { originalConsole }) {
56
55
  rpc
57
56
  };
58
57
  }
59
- const external_node_fs_ = __webpack_require__("fs");
58
+ const external_node_fs_ = __webpack_require__("node:fs");
60
59
  class NodeSnapshotEnvironment {
61
60
  constructor(options = {}){
62
61
  this.options = options;
@@ -243,29 +242,26 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, updateSnapshot,
243
242
  };
244
243
  };
245
244
  const loadFiles = async ({ setupEntries, assetFiles, rstestContext, distPath, testPath, interopDefault, isolate, outputModule })=>{
246
- const { loadModule, updateLatestAssetFiles } = outputModule ? await import("./0~6923.js").then((mod)=>({
245
+ const { loadModule } = outputModule ? await import("./0~6923.js").then((mod)=>({
247
246
  EsmMode: mod.loadEsModule_EsmMode,
248
247
  asModule: mod.asModule,
249
- loadModule: mod.loadModule,
250
- updateLatestAssetFiles: mod.updateLatestAssetFiles
248
+ clearModuleCache: mod.clearModuleCache,
249
+ loadModule: mod.loadModule
251
250
  })) : await import("./0~5835.js").then((mod)=>({
252
251
  cacheableLoadModule: mod.cacheableLoadModule,
253
- loadModule: mod.loadModule,
254
- updateLatestAssetFiles: mod.updateLatestAssetFiles
252
+ clearModuleCache: mod.clearModuleCache,
253
+ loadModule: mod.loadModule
255
254
  }));
256
- if (!isolate) {
257
- updateLatestAssetFiles(assetFiles);
258
- await loadModule({
259
- codeContent: `if (global && typeof global.__rstest_clean_core_cache__ === 'function') {
255
+ if (!isolate) await loadModule({
256
+ codeContent: `if (global && typeof global.__rstest_clean_core_cache__ === 'function') {
260
257
  global.__rstest_clean_core_cache__();
261
258
  }`,
262
- distPath: '',
263
- testPath,
264
- rstestContext,
265
- assetFiles,
266
- interopDefault
267
- });
268
- }
259
+ distPath: '',
260
+ testPath,
261
+ rstestContext,
262
+ assetFiles,
263
+ interopDefault
264
+ });
269
265
  for (const { distPath, testPath } of setupEntries){
270
266
  const setupCodeContent = assetFiles[distPath];
271
267
  await loadModule({
@@ -287,6 +283,7 @@ const loadFiles = async ({ setupEntries, assetFiles, rstestContext, distPath, te
287
283
  });
288
284
  };
289
285
  const runInPool = async (options)=>{
286
+ if ('function' == typeof process.send) process.send(createWorkerMetaMessage(process.pid));
290
287
  isTeardown = false;
291
288
  const { entryInfo: { distPath, testPath }, setupEntries, assets, type, context: { project, runtimeConfig: { isolate, bail } } } = options;
292
289
  const cleanups = [];
@@ -306,6 +303,19 @@ const runInPool = async (options)=>{
306
303
  const teardown = async ()=>{
307
304
  await new Promise((resolve)=>getRealTimers().setTimeout(resolve));
308
305
  await Promise.all(cleanups.map((fn)=>fn()));
306
+ if (!isolate) {
307
+ const { clearModuleCache } = options.context.outputModule ? await import("./0~6923.js").then((mod)=>({
308
+ EsmMode: mod.loadEsModule_EsmMode,
309
+ asModule: mod.asModule,
310
+ clearModuleCache: mod.clearModuleCache,
311
+ loadModule: mod.loadModule
312
+ })) : await import("./0~5835.js").then((mod)=>({
313
+ cacheableLoadModule: mod.cacheableLoadModule,
314
+ clearModuleCache: mod.clearModuleCache,
315
+ loadModule: mod.loadModule
316
+ }));
317
+ clearModuleCache();
318
+ }
309
319
  isTeardown = true;
310
320
  };
311
321
  if ('collect' === type) try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rstest/core",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "The Rsbuild-based test tool.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/web-infra-dev/rstest/issues"
@@ -54,7 +54,7 @@
54
54
  "importMeta.d.ts"
55
55
  ],
56
56
  "dependencies": {
57
- "@rsbuild/core": "1.7.2",
57
+ "@rsbuild/core": "^1.7.3",
58
58
  "@types/chai": "^5.2.3",
59
59
  "tinypool": "^1.1.1"
60
60
  },