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: fix hmr.accept test failing on windows #4314

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Dunqing
Copy link
Member

@Dunqing Dunqing commented Oct 16, 2023

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:

  • 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 Oct 16, 2023

Deploy Preview for fastidious-cascaron-4ded94 canceled.

Name Link
🔨 Latest commit a0e71aa
🔍 Latest deploy log https://app.netlify.com/sites/fastidious-cascaron-4ded94/deploys/65388121355be500097227cd

@sheremet-va
Copy link
Member

sheremet-va commented Oct 16, 2023

It fails with any timeout, something is wrong with a wrapper, it doesn't capture the stdin fully

Comment on lines 12 to 14
editFile(scriptFile, content => content.replace('Hello!', 'Hello world!'))

await viteNode.waitForStderr('Hello world!')
await viteNode.waitForStderr('Hello world!', 40_000)
Copy link
Contributor

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

Copy link
Member Author

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!

Copy link
Contributor

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)

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

3 participants