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

test: reduce usage of execa, add runVitest test utils #3436

Merged
merged 15 commits into from May 24, 2023

Conversation

AriPerkkio
Copy link
Member

Using execa on CI is slow and flaky. This PR removes usage of execa from every test where it's possible and uses startVitest Node API instead. This is done by adding test/test-utils package which provides centralized abstractions for running startVitest. As some of the tests still require running Vitest through CLI, there is also utility method runVitestCli which is a simple abstraction over execa and supports interactive watch-mode simulation.

Goal is to make CI stable and faster, and to not have multiple duplicated implementations for running npx vitest in test files/projects. When adding new tests the runVitest should be used by default. If CLI usage is explicitly required, use runVitestCli instead.

There's quite much changes so I've rebased the commits clearly for possible commit-by-commit review.

@stackblitz
Copy link

stackblitz bot commented May 23, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@sheremet-va
Copy link
Member

Not sure about speed improvements. CI from #3430 is faster 🤔

@AriPerkkio
Copy link
Member Author

The CI speed seems to vary so maybe re-run helps. Mostly I hope these will bring some stability to those flaky execa + Windows test runs.

These results I got on my fork:

And these are the comparison I did locally:

  • test/bail: PR 8.81s, main 13.07s 🚀
  • test/benchmark: PR 4.8s, main 5.5s
  • test/config: PR 0.8s, main 2.3s 🚀
  • test/fails: PR 2.5s, main 7.1s 🚀
  • test/filters: PR 1s, main 1s
  • test/global-setup: PR 2.3s, main 2.3s
  • test/global-setup-fail: PR 0.4s, main 0.6s
  • test/related: PR 1.5s, main 1.4s ⚠️
  • test/reporters: PR 4.9s, main 6s
  • test/shard: PR 1.1s, main 1.8s
  • test/stacktraces: PR 2s, main 6s 🚀
  • test/typescript: PR 2s, main 2.3s
  • test/ui: PR 2s, main 2.3s
  • test/watch: PR 17s, main 17s

@sheremet-va sheremet-va merged commit 9fbb8d3 into vitest-dev:main May 24, 2023
17 checks passed
@AriPerkkio AriPerkkio deleted the test/test-utils branch May 24, 2023 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants