Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vittest fails for webworkers #1584

Closed
6 tasks done
jantimon opened this issue Jul 3, 2022 · 2 comments
Closed
6 tasks done

vittest fails for webworkers #1584

jantimon opened this issue Jul 3, 2022 · 2 comments

Comments

@jantimon
Copy link

jantimon commented Jul 3, 2022

Describe the bug

@vitest/web-worker does not allow to test web-workers

The test fails immediately with the following error:

Error: `new URL(url, import.meta.url)` is not supported in SSR.

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-wn53bu?file=vite.config.ts

System Info

System:
    OS: macOS 12.4
    CPU: (10) x64 Apple M1 Max
    Memory: 3.91 GB / 64.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.13.0 - ~/.nvs/default/bin/node
    Yarn: 1.22.17 - ~/.nvs/default/bin/yarn
    npm: 8.1.3 - ~/.nvs/default/bin/npm
    Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman
  Browsers:
    Brave Browser: 103.1.40.107
    Chrome: 103.0.5060.53
    Chrome Canary: 105.0.5146.0
    Edge: 103.0.1264.44
    Firefox: 99.0
    Firefox Developer Edition: 102.0
    Safari: 15.5
    Safari Technology Preview: 15.4
  npmPackages:
    vitest: ^0.17.0 => 0.17.0

Used Package Manager

yarn

Validations

@sheremet-va
Copy link
Member

This is Vite compilation error. Please, make an issue in Vite repo.

In the meantime, you can rewrite it as:

const baseUrl = import.meta.url
new URL(url, baseUrl)

@sheremet-va
Copy link
Member

sheremet-va commented Jul 3, 2022

Although I think it's already fixed: vitejs/vite#8846

You might need to update to Vite 3.0.0-beta.6, or ask Vite team to back port it to Vite 2.

@sheremet-va sheremet-va closed this as not planned Won't fix, can't repro, duplicate, stale Jul 3, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jun 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants