feat(worker): support dynamic worker option fields #22575
Annotations
8 errors
Test unit:
packages/vite/src/node/__tests__/plugins/workerImportMetaUrl.spec.ts#L31
Error: Snapshot `workerImportMetaUrlPlugin > without worker options 1` mismatched
Expected: ""new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=classic", import.meta.url))""
Received: ""new Worker(new URL(/* @vite-ignore */ "/@fs/D:/a/vite/vite/packages/vite/src/node/__tests__/plugins/fixtures/worker/worker.js?worker_file&type=classic", import.meta.url))""
❯ packages/vite/src/node/__tests__/plugins/workerImportMetaUrl.spec.ts:31:7
|
Test unit:
packages/vite/src/node/__tests__/plugins/workerImportMetaUrl.spec.ts#L41
Error: Snapshot `workerImportMetaUrlPlugin > with shared worker 1` mismatched
Expected: ""new SharedWorker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=classic", import.meta.url))""
Received: ""new SharedWorker(new URL(/* @vite-ignore */ "/@fs/D:/a/vite/vite/packages/vite/src/node/__tests__/plugins/fixtures/worker/worker.js?worker_file&type=classic", import.meta.url))""
❯ packages/vite/src/node/__tests__/plugins/workerImportMetaUrl.spec.ts:41:7
|
Test unit:
packages/vite/src/node/__tests__/plugins/workerImportMetaUrl.spec.ts#L51
Error: Snapshot `workerImportMetaUrlPlugin > with static worker options 1` mismatched
Expected: ""new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", import.meta.url), { type: "module", name: "worker1" })""
Received: ""new Worker(new URL(/* @vite-ignore */ "/@fs/D:/a/vite/vite/packages/vite/src/node/__tests__/plugins/fixtures/worker/worker.js?worker_file&type=module", import.meta.url), { type: "module", name: "worker1" })""
❯ packages/vite/src/node/__tests__/plugins/workerImportMetaUrl.spec.ts:51:7
|
Test unit:
packages/vite/src/node/__tests__/plugins/workerImportMetaUrl.spec.ts#L61
Error: Snapshot `workerImportMetaUrlPlugin > with dynamic name field in worker options 1` mismatched
Expected: ""const id = 1; new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=classic", import.meta.url), { name: "worker" + id })""
Received: ""const id = 1; new Worker(new URL(/* @vite-ignore */ "/@fs/D:/a/vite/vite/packages/vite/src/node/__tests__/plugins/fixtures/worker/worker.js?worker_file&type=classic", import.meta.url), { name: "worker" + id })""
❯ packages/vite/src/node/__tests__/plugins/workerImportMetaUrl.spec.ts:61:7
|
Test unit:
packages/vite/src/node/__tests__/plugins/workerImportMetaUrl.spec.ts#L71
Error: Snapshot `workerImportMetaUrlPlugin > with dynamic name field and static type in worker options 1` mismatched
Expected: ""const id = 1; new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", import.meta.url), { name: "worker" + id, type: "module" })""
Received: ""const id = 1; new Worker(new URL(/* @vite-ignore */ "/@fs/D:/a/vite/vite/packages/vite/src/node/__tests__/plugins/fixtures/worker/worker.js?worker_file&type=module", import.meta.url), { name: "worker" + id, type: "module" })""
❯ packages/vite/src/node/__tests__/plugins/workerImportMetaUrl.spec.ts:71:7
|
Test unit:
packages/vite/src/node/__tests__/plugins/workerImportMetaUrl.spec.ts#L81
Error: Snapshot `workerImportMetaUrlPlugin > with parenthesis inside of worker options 1` mismatched
Expected: ""const worker = new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", import.meta.url), { name: genName(), type: "module"})""
Received: ""const worker = new Worker(new URL(/* @vite-ignore */ "/@fs/D:/a/vite/vite/packages/vite/src/node/__tests__/plugins/fixtures/worker/worker.js?worker_file&type=module", import.meta.url), { name: genName(), type: "module"})""
❯ packages/vite/src/node/__tests__/plugins/workerImportMetaUrl.spec.ts:81:7
|
Test unit:
packages/vite/src/node/__tests__/plugins/workerImportMetaUrl.spec.ts#L97
Error: Snapshot `workerImportMetaUrlPlugin > with multi-line code and worker options 1` mismatched
- Expected
+ Received
@@ -1,7 +1,7 @@
"
- const worker = new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", import.meta.url), {
+ const worker = new Worker(new URL(/* @vite-ignore */ "/@fs/D:/a/vite/vite/packages/vite/src/node/__tests__/plugins/fixtures/worker/worker.js?worker_file&type=module", import.meta.url), {
name: genName(),
type: "module",
},
)
❯ packages/vite/src/node/__tests__/plugins/workerImportMetaUrl.spec.ts:97:7
|
Test unit
Process completed with exit code 1.
|
Loading