-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: fix hmr.accept test failing on windows #4314
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for fastidious-cascaron-4ded94 canceled.
|
It fails with any timeout, something is wrong with a wrapper, it doesn't capture the stdin fully |
test/vite-node/test/hmr.test.ts
Outdated
editFile(scriptFile, content => content.replace('Hello!', 'Hello world!')) | ||
|
||
await viteNode.waitForStderr('Hello world!') | ||
await viteNode.waitForStderr('Hello world!', 40_000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's same with vitejs/vite#11075 (comment)?
Doing like this might work.
const promise = viteNode.waitForStderr('Hello world!')
editFile(scriptFile, content => content.replace('Hello!', 'Hello world!'))
await promise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this information! I will try this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, my bad, it needs to be:
const promises = [
viteNode.waitForStderr('Hello world!'),
viteNode.waitForStderr('Accept'),
viteNode.waitForStdout(`[vite-node] hot updated: ${scriptFile}`)
]
editFile(scriptFile, content => content.replace('Hello!', 'Hello world!'))
await Promise.all(promises)
Description
Fixes: https://github.com/vitest-dev/vitest/actions/runs/6510527559/job/17684432483
The test always fails on windows, but some time will work. I think we should make its timeout a little longer to get this test to run steadily
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yaml
unless you introduce a new test example.Tests
pnpm test:ci
.Documentation
pnpm run docs
command.Changesets
feat:
,fix:
,perf:
,docs:
, orchore:
.