itwinjs-core
itwinjs-core copied to clipboard
Investigate PrimitiveConverters.test.ts failures
Look into cesium-renderer's PrimitiveConverters.test.ts failures showing this error:
Vitest caught 1 unhandled error during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: [MSW] Failed to register a Service Worker for scope ('http://localhost:63315/') with script ('http://localhost:63315/mockServiceWorker.js'): Service Worker script does not exist at the given path.
Did you forget to run "npx msw init <PUBLIC_DIR>"?
Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/init
❯ getWorkerInstance ../../common/temp/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/msw/lib/browser/index.mjs:255:13
❯ startWorkerInstance ../../common/temp/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/msw/lib/browser/index.mjs:1265:24
❯ SetupWorkerApi.start ../../common/temp/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/msw/lib/browser/index.mjs:3077:26
Possible solutions
- Figure out why MSW is required. If including it is reasonable, include pretest and posttest package.json scripts to add mockServiceWorker.js and clean up after
- Switch to using sinon to mock in PrimitiveConverters.test.ts instead of vi.mock() (I suspect that might be related bc itwinjs doesnt use vi.mock() anywhere else)