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(ssr): Fix flakes #34443

Merged
merged 2 commits into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion integration-tests/ssr/__tests__/ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe(`SSR`, () => {
expect(String(childProcess.stdout)).toContain(
`testing these paths for differences between dev & prod outputs`
)
}, 15000)
}, 30000)

test(`it generates an error page correctly`, async () => {
const src = path.join(__dirname, `/fixtures/bad-page.js`)
Expand Down
14 changes: 11 additions & 3 deletions integration-tests/ssr/test-output.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ async function run() {
// Fetch once to trigger re-compilation.
await fetch(`${devSiteBasePath}/${path}`)

// Then wait for 6 seconds to ensure it's ready to go.
// Then wait for a second to ensure it's ready to go.
// Otherwise, tests are flaky depending on the speed of the testing machine.
await new Promise(resolve => {
setTimeout(() => resolve(), 6000)
setTimeout(() => resolve(), 1000)
})

let devStatus = 200
Expand Down Expand Up @@ -103,7 +103,15 @@ async function run() {
paths
)

const results = await Promise.all(paths.map(p => comparePath(p)))
const results = []

// Run comparisons serially, otherwise recompilation fetches
// interfere with each other when run within Promise.all
for (const path of paths) {
const result = await comparePath(path)
results.push(result)
}

// Test all true
if (results.every(r => r)) {
process.exit(0)
Expand Down