@rstest/core 0.7.4 → 0.7.6

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 (43) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/0~130.js +2 -2
  3. package/dist/{0~173.js → 0~2173.js} +15 -8
  4. package/dist/{0~255.js → 0~2255.js} +1 -1
  5. package/dist/{0~346.js → 0~3346.js} +2 -2
  6. package/dist/{0~919.js → 0~3919.js} +1 -1
  7. package/dist/{0~403.js → 0~4403.js} +3 -3
  8. package/dist/{0~809.js → 0~4809.js} +2 -2
  9. package/dist/{0~835.js → 0~5835.js} +12 -7
  10. package/dist/{0~151.js → 0~6151.js} +163 -292
  11. package/dist/0~62.js +2 -2
  12. package/dist/{0~588.js → 0~6588.js} +6 -6
  13. package/dist/{0~907.js → 0~6907.js} +2 -2
  14. package/dist/{0~923.js → 0~6923.js} +11 -7
  15. package/dist/0~6973.js +50 -0
  16. package/dist/{0~583.js → 0~7583.js} +4 -4
  17. package/dist/{0~426.js → 0~8426.js} +3 -3
  18. package/dist/0~89.js +81 -40
  19. package/dist/0~8957.js +149 -0
  20. package/dist/{0~634.js → 0~9634.js} +9 -5
  21. package/dist/{157.js → 1157.js} +5 -42
  22. package/dist/{216.js → 3216.js} +2 -2
  23. package/dist/{278.js → 3278.js} +2 -2
  24. package/dist/{397.js → 4397.js} +1 -1
  25. package/dist/4881.js +3 -0
  26. package/dist/554.js +26 -21
  27. package/dist/{664.js → 5693.js} +0 -2
  28. package/dist/{734.js → 5734.js} +4 -3
  29. package/dist/6198.js +3 -0
  30. package/dist/{913.js → 7913.js} +7 -6
  31. package/dist/{131.js → 9131.js} +31 -20
  32. package/dist/globalSetupWorker.js +8 -6
  33. package/dist/index.d.ts +21 -1
  34. package/dist/index.js +1 -1
  35. package/dist/rslib-runtime.js +1 -1
  36. package/dist/worker.d.ts +21 -1
  37. package/package.json +5 -5
  38. package/dist/198.js +0 -4
  39. /package/dist/{0~681.js → 0~3062.js} +0 -0
  40. /package/dist/{0~151.js.LICENSE.txt → 0~6151.js.LICENSE.txt} +0 -0
  41. /package/dist/{0~583.js.LICENSE.txt → 0~7583.js.LICENSE.txt} +0 -0
  42. /package/dist/{672.js → 1672.js} +0 -0
  43. /package/dist/{913.js.LICENSE.txt → 7913.js.LICENSE.txt} +0 -0
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025-present Bytedance, Inc. and its affiliates.
3
+ Copyright (c) 2025-present ByteDance, Inc. and its affiliates.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/0~130.js CHANGED
@@ -3,8 +3,8 @@ import 'module';
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
4
  import { AssertionError, strict } from "node:assert";
5
5
  import { Console } from "node:console";
6
- import "./664.js";
7
- import { prettyTime } from "./157.js";
6
+ import "./5693.js";
7
+ import { prettyTime } from "./1157.js";
8
8
  const external_node_util_ = __webpack_require__("node:util");
9
9
  const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
10
10
  var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
@@ -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 "./664.js";
5
- import { getTestEntries, getSetupFiles, isTTY } from "./157.js";
6
- import { createCoverageProvider } from "./734.js";
4
+ import "./5693.js";
5
+ import { getTestEntries, isTTY } from "./1157.js";
6
+ import { createCoverageProvider } from "./5734.js";
7
7
  import { prepareRsbuild, createPool, createRsbuildServer, runGlobalTeardown, runGlobalSetup } from "./0~89.js";
8
- import { clearScreen, logger_logger } from "./278.js";
8
+ import { clearScreen, logger_logger } from "./3278.js";
9
9
  const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
10
10
  var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
11
11
  const isCliShortcutsEnabled = ()=>isTTY('stdin');
@@ -168,6 +168,9 @@ async function runTests(context) {
168
168
  });
169
169
  return entries;
170
170
  };
171
+ const { getSetupFiles } = await import("./0~6973.js").then((mod)=>({
172
+ getSetupFiles: mod.getSetupFiles
173
+ }));
171
174
  const setupFiles = Object.fromEntries(context.projects.map((project)=>{
172
175
  const { environmentName, rootPath, normalizedConfig: { setupFiles } } = project;
173
176
  return [
@@ -183,12 +186,14 @@ async function runTests(context) {
183
186
  ];
184
187
  }));
185
188
  const rsbuildInstance = await prepareRsbuild(context, globTestSourceEntries, setupFiles, globalSetupFiles);
189
+ const isWatchMode = 'watch' === command;
186
190
  const { getRsbuildStats, closeServer } = await createRsbuildServer({
187
191
  inspectedConfig: {
188
192
  ...context.normalizedConfig,
189
193
  projects: context.projects.map((p)=>p.normalizedConfig)
190
194
  },
191
- globTestSourceEntries: 'watch' === command ? globTestSourceEntries : async (name)=>{
195
+ isWatchMode,
196
+ globTestSourceEntries: isWatchMode ? globTestSourceEntries : async (name)=>{
192
197
  if (entriesCache.has(name)) return entriesCache.get(name).entries;
193
198
  return globTestSourceEntries(name);
194
199
  },
@@ -197,7 +202,8 @@ async function runTests(context) {
197
202
  rsbuildInstance,
198
203
  rootPath
199
204
  });
200
- const recommendWorkerCount = 'watch' === command ? 1 / 0 : Array.from(entriesCache.values()).reduce((acc, entry)=>acc + Object.keys(entry.entries).length, 0);
205
+ const entryFiles = Array.from(entriesCache.values()).reduce((acc, entry)=>acc.concat(Object.values(entry.entries) || []), []);
206
+ const recommendWorkerCount = 'watch' === command ? 1 / 0 : entryFiles.length;
201
207
  const pool = await createPool({
202
208
  context,
203
209
  recommendWorkerCount
@@ -209,6 +215,7 @@ async function runTests(context) {
209
215
  const currentEntries = [];
210
216
  const currentDeletedEntries = [];
211
217
  context.stateManager.reset();
218
+ context.stateManager.testFiles = isWatchMode ? void 0 : entryFiles;
212
219
  const returns = await Promise.all(context.projects.map(async (p)=>{
213
220
  const { assetNames, entries, setupEntries, globalSetupEntries, getAssetFiles, getSourceMaps, affectedEntries, deletedEntries } = await getRsbuildStats({
214
221
  environmentName: p.environmentName,
@@ -307,7 +314,7 @@ async function runTests(context) {
307
314
  filterRerunTestPaths: currentEntries.length ? currentEntries.map((e)=>e.testPath) : void 0
308
315
  });
309
316
  if (coverageProvider && (!isFailure || coverage.reportOnFailure)) {
310
- const { generateCoverage } = await import("./0~403.js").then((mod)=>({
317
+ const { generateCoverage } = await import("./0~4403.js").then((mod)=>({
311
318
  generateCoverage: mod.generateCoverage
312
319
  }));
313
320
  await generateCoverage(context, results, coverageProvider);
@@ -324,7 +331,7 @@ async function runTests(context) {
324
331
  if (enableCliShortcuts) if (snapshotManager.summary.unmatched) logger_logger.log(` ${picocolors_default().dim('press')} ${picocolors_default().yellow(picocolors_default().bold('u'))} ${picocolors_default().dim('to update snapshot')}${picocolors_default().dim(', press')} ${picocolors_default().bold('h')} ${picocolors_default().dim('to show help')}\n`);
325
332
  else logger_logger.log(` ${picocolors_default().dim('press')} ${picocolors_default().bold('h')} ${picocolors_default().dim('to show help')}${picocolors_default().dim(', press')} ${picocolors_default().bold('q')} ${picocolors_default().dim('to quit')}\n`);
326
333
  };
327
- const { onBeforeRestart } = await import("./0~588.js").then((mod)=>({
334
+ const { onBeforeRestart } = await import("./0~6588.js").then((mod)=>({
328
335
  onBeforeRestart: mod.onBeforeRestart
329
336
  }));
330
337
  onBeforeRestart(async ()=>{
@@ -1,7 +1,7 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
- import "./664.js";
4
+ import "./5693.js";
5
5
  const external_node_fs_ = __webpack_require__("fs");
6
6
  const pluginCoverageCore = (coverageOptions)=>({
7
7
  name: 'rstest:coverage-core',
@@ -1,6 +1,5 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
- import node_vm from "node:vm";
4
3
  const shouldInterop = ({ interopDefault = true, modulePath, mod })=>{
5
4
  if (!interopDefault) return false;
6
5
  return !modulePath.endsWith('.mjs') && 'default' in mod;
@@ -43,4 +42,5 @@ const asModule = async (something, defaultExport, context, unlinked)=>{
43
42
  await m.evaluate();
44
43
  return m;
45
44
  };
46
- export { asModule, interopModule, node_vm, shouldInterop };
45
+ export { default as node_vm } from "node:vm";
46
+ export { asModule, interopModule, shouldInterop };
@@ -1,7 +1,7 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
- import "./664.js";
4
+ import "./5693.js";
5
5
  __webpack_require__.add({
6
6
  "../../node_modules/.pnpm/js-tokens@4.0.0/node_modules/js-tokens/index.js" (__unused_rspack_module, exports) {
7
7
  Object.defineProperty(exports, "__esModule", {
@@ -1,7 +1,7 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
- import { isDynamicPattern, glob } from "./157.js";
4
- import { normalize, logger_logger } from "./278.js";
3
+ import { isDynamicPattern, glob } from "./1157.js";
4
+ import { normalize, logger_logger } from "./3278.js";
5
5
  const getIncludedFiles = async (coverage, rootPath)=>{
6
6
  const ignoredPatterns = coverage.exclude?.filter((item)=>isDynamicPattern(item) || item.startsWith(rootPath) || item.startsWith('./'));
7
7
  const allFiles = await glob(coverage.include, {
@@ -42,7 +42,7 @@ async function generateCoverage(context, results, coverageProvider) {
42
42
  }
43
43
  await coverageProvider.generateReports(finalCoverageMap, coverage);
44
44
  if (coverage.thresholds) {
45
- const { checkThresholds } = await import("./0~426.js").then((mod)=>({
45
+ const { checkThresholds } = await import("./0~8426.js").then((mod)=>({
46
46
  checkThresholds: mod.checkThresholds
47
47
  }));
48
48
  const thresholdResult = checkThresholds({
@@ -1,7 +1,7 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
- import { checkPkgInstalled } from "./913.js";
4
- import { installGlobal, addDefaultErrorHandler } from "./0~681.js";
3
+ import { checkPkgInstalled } from "./7913.js";
4
+ import { installGlobal, addDefaultErrorHandler } from "./0~3062.js";
5
5
  const environment = {
6
6
  name: 'happy-dom',
7
7
  async setup (global, { happyDom = {} }) {
@@ -1,11 +1,16 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
- import { createRequire as external_node_module_createRequire } from "./664.js";
5
- import { pathToFileURL } from "./198.js";
6
- import { node_vm, asModule, shouldInterop, interopModule } from "./0~346.js";
7
- import { posix, logger_logger } from "./278.js";
4
+ import "./5693.js";
5
+ import { createRequire as external_node_module_createRequire } from "./4881.js";
6
+ import { pathToFileURL } from "./6198.js";
7
+ import { node_vm, asModule, shouldInterop, interopModule } from "./0~3346.js";
8
+ import { posix, logger_logger } from "./3278.js";
8
9
  const external_node_path_ = __webpack_require__("node:path");
10
+ let latestAssetFiles = {};
11
+ const updateLatestAssetFiles = (assetFiles)=>{
12
+ latestAssetFiles = assetFiles;
13
+ };
9
14
  const isRelativePath = (p)=>/^\.\.?\//.test(p);
10
15
  const createRequire = (filename, distPath, rstestContext, assetFiles, interopDefault)=>{
11
16
  const _require = (()=>{
@@ -18,7 +23,7 @@ const createRequire = (filename, distPath, rstestContext, assetFiles, interopDef
18
23
  const require = (id)=>{
19
24
  const currentDirectory = posix.dirname(distPath);
20
25
  const joinedPath = isRelativePath(id) ? posix.join(currentDirectory, id) : id;
21
- const content = assetFiles[joinedPath];
26
+ const content = assetFiles[joinedPath] || latestAssetFiles[joinedPath];
22
27
  if (content) try {
23
28
  return cacheableLoadModule({
24
29
  codeContent: content,
@@ -100,7 +105,7 @@ const loadModule = ({ codeContent, distPath, testPath, rstestContext, assetFiles
100
105
  require: createRequire(testPath, distPath, rstestContext, assetFiles, interopDefault),
101
106
  readWasmFile: (wasmPath, callback)=>{
102
107
  const joinedPath = isRelativePath(wasmPath) ? posix.join(posix.dirname(distPath), wasmPath) : wasmPath;
103
- const content = assetFiles[posix.normalize(joinedPath)];
108
+ const content = assetFiles[posix.normalize(joinedPath)] || latestAssetFiles[posix.normalize(joinedPath)];
104
109
  if (content) callback(null, Buffer.from(content, 'base64'));
105
110
  else callback(new Error(`WASM file ${joinedPath} not found in asset files.`));
106
111
  },
@@ -141,4 +146,4 @@ const cacheableLoadModule = ({ codeContent, distPath, testPath, rstestContext, a
141
146
  moduleCache.set(testPath, mod);
142
147
  return mod;
143
148
  };
144
- export { cacheableLoadModule, loadModule };
149
+ export { cacheableLoadModule, loadModule, updateLatestAssetFiles };