-
-
Notifications
You must be signed in to change notification settings - Fork 6.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
ssr-vue
client navigation test is flaky
#2646
Comments
Added a "test" label since this isn't a user-affecting bug. |
I'm able to reproduce that on my machine! System InfoOutput of System:
OS: Linux 5.10 Arch Linux
CPU: (28) x64 Intel(R) Core(TM) i9-10940X CPU @ 3.30GHz
Memory: 51.93 GB / 62.49 GB
Container: Yes
Shell: 5.8 - /usr/bin/zsh
Binaries:
Node: 15.6.0 - ~/.nvm/versions/node/v15.6.0/bin/node
Yarn: 1.22.10 - /usr/bin/yarn
npm: 7.4.0 - ~/.nvm/versions/node/v15.6.0/bin/npm Used package manager: yarn Also here and there our CI now can reproduce this (not only the new GHA runners, but also CircleCI and AppVeyor before sometimes failed with that randomly) Example: |
I had the same problem with vite-plugin-ssr's test suite. I solved it by doing the following. // Client-side routing
await page.click('a[href="/star-wars"]')
await autoRetry(async () => {
expect(await page.textContent('h1')).toBe('Star Wars Movies')
}) async function autoRetry(test: () => void | Promise<void>): Promise<void> {
const timeout = 60 * 1000
const period = 100
const numberOfTries = timeout / period
let i = 0
while (true) {
try {
await test()
return
} catch (err) {
i = i + 1
if (i > numberOfTries) {
throw err
}
}
await sleep(period)
}
} |
(It makes sense when you think about it: Jest cannot know when a client-side routing is finished. It's inherently a race condition from Jest's perspective.) |
Describe the bug
The client navigation test in
packages/playground/ssr-vue/__tests__/ssr-vue.spec.ts
is flaky and can erroneously fail a test run.Reproduction
I am always able to replicate this on my system, but I suspect not every system has this issue.
On a fresh clone of the Vite monorepo:
Here's a CI run of it failing despite no changes to Vite: https://app.circleci.com/pipelines/github/vitejs/vite/3295/workflows/5c10a93d-39c3-40cd-becc-56a1c2601d7f/jobs/3190
System Info
vite
version: commit 23f57eeLocal System
CI System
Logs
The text was updated successfully, but these errors were encountered: