Skip to content

Commit

Permalink
chore: fix typo in @vitest/web-worker README, use standartised method…
Browse files Browse the repository at this point in the history
… for mock paths in Worker constructors
  • Loading branch information
sheremet-va committed Dec 16, 2022
1 parent c3a6352 commit eeea496
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/web-worker/README.md
Expand Up @@ -40,7 +40,7 @@ export default defineConfig({
})
```

You can also import `defineWebWorkers` from `@vitest/web-worker/pure` to defined workers, whenever you need:
You can also import `defineWebWorkers` from `@vitest/web-worker/pure` to define workers, whenever you need:

```js
import { defineWebWorkers } from '@vitest/web-worker/pure'
Expand Down
2 changes: 1 addition & 1 deletion packages/web-worker/src/shared-worker.ts
Expand Up @@ -112,7 +112,7 @@ export function createSharedWorkerConstructor(): typeof SharedWorker {

runner.executeFile(fsPath).then(() => {
// worker should be new every time, invalidate its sub dependency
runnerOptions.moduleCache.invalidateSubDepTree([fsPath, `mock:${fsPath}`])
runnerOptions.moduleCache.invalidateSubDepTree([fsPath, runner.mocker.getMockPath(fsPath)])
this._vw_workerTarget.dispatchEvent(
new MessageEvent('connect', {
ports: [this._vw_workerPort],
Expand Down
2 changes: 1 addition & 1 deletion packages/web-worker/src/worker.ts
Expand Up @@ -77,7 +77,7 @@ export function createWorkerConstructor(options?: DefineWorkerOptions): typeof W

runner.executeFile(fsPath).then(() => {
// worker should be new every time, invalidate its sub dependency
runnerOptions.moduleCache.invalidateSubDepTree([fsPath, `mock:${fsPath}`])
runnerOptions.moduleCache.invalidateSubDepTree([fsPath, runner.mocker.getMockPath(fsPath)])
const q = this._vw_messageQueue
this._vw_messageQueue = null
if (q)
Expand Down

0 comments on commit eeea496

Please sign in to comment.