@vitest/web-worker 0.28.4 → 0.29.0

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 (2) hide show
  1. package/dist/pure.js +6 -6
  2. package/package.json +2 -2
package/dist/pure.js CHANGED
@@ -1,8 +1,8 @@
1
- import { VitestRunner } from 'vitest/node';
1
+ import { VitestExecutor } from 'vitest/node';
2
2
  import createDebug from 'debug';
3
3
  import { MessageChannel } from 'worker_threads';
4
4
 
5
- class InlineWorkerRunner extends VitestRunner {
5
+ class InlineWorkerRunner extends VitestExecutor {
6
6
  constructor(options, context) {
7
7
  super(options);
8
8
  this.context = context;
@@ -297,7 +297,7 @@ function createClonedMessageEvent(data, transferOrOptions, clone) {
297
297
  });
298
298
  }
299
299
  if (clone !== "none") {
300
- debug("create message event, using polifylled structured clone");
300
+ debug("create message event, using polyfilled structured clone");
301
301
  (transfer == null ? void 0 : transfer.length) && console.warn(
302
302
  '[@vitest/web-worker] `structuredClone` is not supported in this environment. Falling back to polyfill, your transferable options will be lost. Set `VITEST_WEB_WORKER_CLONE` environmental variable to "none", if you don\'t want to loose it,or update to Node 17+.'
303
303
  );
@@ -323,13 +323,13 @@ function createMessageEvent(data, transferOrOptions, clone) {
323
323
  }
324
324
  }
325
325
  function getRunnerOptions() {
326
- const { config, rpc, mockMap, moduleCache } = getWorkerState();
326
+ const { config, ctx, rpc, mockMap, moduleCache } = getWorkerState();
327
327
  return {
328
328
  fetchModule(id) {
329
- return rpc.fetch(id);
329
+ return rpc.fetch(id, ctx.environment.name);
330
330
  },
331
331
  resolveId(id, importer) {
332
- return rpc.resolveId(id, importer);
332
+ return rpc.resolveId(id, importer, ctx.environment.name);
333
333
  },
334
334
  moduleCache,
335
335
  mockMap,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/web-worker",
3
3
  "type": "module",
4
- "version": "0.28.4",
4
+ "version": "0.29.0",
5
5
  "description": "Web Worker support for testing in Vitest",
6
6
  "repository": {
7
7
  "type": "git",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "debug": "^4.3.4",
35
- "vite-node": "0.28.4"
35
+ "vite-node": "0.29.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/debug": "^4.1.7",