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

Docs: Comparison with Web Test Runner #102

Closed
patak-dev opened this issue Dec 12, 2021 · 2 comments · Fixed by #128
Closed

Docs: Comparison with Web Test Runner #102

patak-dev opened this issue Dec 12, 2021 · 2 comments · Fixed by #128
Labels
documentation Improvements or additions to documentation pr welcome

Comments

@patak-dev
Copy link
Member

patak-dev commented Dec 12, 2021

There is a vite-web-test-runner-plugin (my notes).

@patak-dev patak-dev added documentation Improvements or additions to documentation pr welcome labels Dec 12, 2021
@IanVS
Copy link
Contributor

IanVS commented Dec 13, 2021

I've been using the vite web-test-runner plugin for a while now, and for the most part it works pretty well. I'll share a bit of my experience here.

  • It uses mocha in a headless browser, and communicates to it over websockets, so it's actually pretty fast to run the tests, and there's no jsdom needed. This is the main draw for me, that it runs in the same environments (browsers) as my application.
  • It's possible to "debug" in a real browser, although the UI does not appear, so it's not quite as nice as something like cypress for debugging.
  • There is an incompatibility with @web/test-runner-commands (Does not work with @web/test-runner-commands material-svelte/vite-web-test-runner-plugin#11), so it's not possible to do things like set the viewport for particular tests. Vitest doesn't run in a browser (yet? 😉), so it doesn't have/need a feature like browser commands.
  • I had a tricky time at first using jest assertions and mocks, but eventually got it working, partly through use of storybook's wrapper around expect, which makes it browser-compatible.
  • The watch mode for @web/test-runner is not as good as vitest, I think. It does not always detect that I've changed a file that should cause a re-run, and it doesn't automatically scope down to running only the needed tests. Running in "focus" mode helps, but it shows a long list of all the test files with numbers next to them, and you have to enter the number for the test you want to focus on.

@patak-dev
Copy link
Member Author

Thanks @IanVS! Would you mind sending a PR with a short paragraph to https://github.com/antfu-sponsors/vitest/blob/main/docs/guide/comparisons.md?

@github-actions github-actions bot locked and limited conversation to collaborators Jun 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation pr welcome
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants