Skip to content

Comments

fix: fix vm tests flakiness#7741

Merged
sheremet-va merged 6 commits intovitest-dev:mainfrom
sheremet-va:refactor/use-context-on-synthetic-module
Mar 26, 2025
Merged

fix: fix vm tests flakiness#7741
sheremet-va merged 6 commits intovitest-dev:mainfrom
sheremet-va:refactor/use-context-on-synthetic-module

Conversation

@sheremet-va
Copy link
Member

@sheremet-va sheremet-va commented Mar 26, 2025

Description

Vitest did not properly cache synthetic modules. After adding the cache, flakiness disappears. I wasn't able to reproduce this with a simple setup, unfortunately, so I am still not sure what exactly caused the crashes to happen.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

@netlify
Copy link

netlify bot commented Mar 26, 2025

Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit 5ed3040
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/67e3e5cf89c46a00087eb535
😎 Deploy Preview https://deploy-preview-7741--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@sheremet-va sheremet-va changed the title refactor: use context instead of return value in synthetic module callback fix: use context instead of return value in synthetic module callback Mar 26, 2025
@sheremet-va sheremet-va changed the title fix: use context instead of return value in synthetic module callback fix: fix vm tests flakiness Mar 26, 2025
Copy link
Member

@AriPerkkio AriPerkkio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work!

Can we include these tests too now:

it.runIf(major < 22)('stacktrace in vmThreads', async () => {

const [major] = process.version.slice(1).split('.').map(num => Number(num))
test.runIf(major < 22)('importing files in restricted fs works correctly', async () => {

const [major] = process.version.slice(1).split('.').map(num => Number(num))
test.each(['threads', 'vmThreads'])('%s: print stdout and stderr correctly when called in the setup file', async (pool) => {

@sheremet-va
Copy link
Member Author

Can we include these tests too now:

For sure!

AriPerkkio
AriPerkkio previously approved these changes Mar 26, 2025
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.

2 participants