@vitest/web-worker 0.31.3 → 0.32.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 +24 -24
  2. package/package.json +1 -1
package/dist/pure.js CHANGED
@@ -378,25 +378,25 @@ function createWorkerConstructor(options) {
378
378
  runner.resolveUrl(id).then(([, fsPath]) => {
379
379
  this._vw_name = (options2 == null ? void 0 : options2.name) ?? fsPath;
380
380
  debug("initialize worker %s", this._vw_name);
381
- runner.executeFile(fsPath).then(() => {
381
+ return runner.executeFile(fsPath).then(() => {
382
382
  runnerOptions.moduleCache.invalidateSubDepTree([fsPath, runner.mocker.getMockPath(fsPath)]);
383
383
  const q = this._vw_messageQueue;
384
384
  this._vw_messageQueue = null;
385
385
  if (q)
386
386
  q.forEach(([data, transfer]) => this.postMessage(data, transfer), this);
387
387
  debug("worker %s successfully initialized", this._vw_name);
388
- }).catch((e) => {
389
- var _a2;
390
- debug("worker %s failed to initialize: %o", this._vw_name, e);
391
- const EventConstructor = globalThis.ErrorEvent || globalThis.Event;
392
- const error = new EventConstructor("error", {
393
- error: e,
394
- message: e.message
395
- });
396
- this.dispatchEvent(error);
397
- (_a2 = this.onerror) == null ? void 0 : _a2.call(this, error);
398
- console.error(e);
399
388
  });
389
+ }).catch((e) => {
390
+ var _a2;
391
+ debug("worker %s failed to initialize: %o", this._vw_name, e);
392
+ const EventConstructor = globalThis.ErrorEvent || globalThis.Event;
393
+ const error = new EventConstructor("error", {
394
+ error: e,
395
+ message: e.message
396
+ });
397
+ this.dispatchEvent(error);
398
+ (_a2 = this.onerror) == null ? void 0 : _a2.call(this, error);
399
+ console.error(e);
400
400
  });
401
401
  }
402
402
  addEventListener(type, callback, options2) {
@@ -515,7 +515,7 @@ function createSharedWorkerConstructor() {
515
515
  runner.resolveUrl(id).then(([, fsPath]) => {
516
516
  this._vw_name = name ?? fsPath;
517
517
  debug("initialize shared worker %s", this._vw_name);
518
- runner.executeFile(fsPath).then(() => {
518
+ return runner.executeFile(fsPath).then(() => {
519
519
  runnerOptions.moduleCache.invalidateSubDepTree([fsPath, runner.mocker.getMockPath(fsPath)]);
520
520
  this._vw_workerTarget.dispatchEvent(
521
521
  new MessageEvent("connect", {
@@ -523,18 +523,18 @@ function createSharedWorkerConstructor() {
523
523
  })
524
524
  );
525
525
  debug("shared worker %s successfully initialized", this._vw_name);
526
- }).catch((e) => {
527
- var _a2;
528
- debug("shared worker %s failed to initialize: %o", this._vw_name, e);
529
- const EventConstructor = globalThis.ErrorEvent || globalThis.Event;
530
- const error = new EventConstructor("error", {
531
- error: e,
532
- message: e.message
533
- });
534
- this.dispatchEvent(error);
535
- (_a2 = this.onerror) == null ? void 0 : _a2.call(this, error);
536
- console.error(e);
537
526
  });
527
+ }).catch((e) => {
528
+ var _a2;
529
+ debug("shared worker %s failed to initialize: %o", this._vw_name, e);
530
+ const EventConstructor = globalThis.ErrorEvent || globalThis.Event;
531
+ const error = new EventConstructor("error", {
532
+ error: e,
533
+ message: e.message
534
+ });
535
+ this.dispatchEvent(error);
536
+ (_a2 = this.onerror) == null ? void 0 : _a2.call(this, error);
537
+ console.error(e);
538
538
  });
539
539
  }
540
540
  }, _a.__VITEST_WEB_WORKER__ = true, _a;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/web-worker",
3
3
  "type": "module",
4
- "version": "0.31.3",
4
+ "version": "0.32.0",
5
5
  "description": "Web Worker support for testing in Vitest",
6
6
  "license": "MIT",
7
7
  "funding": "https://opencollective.com/vitest",