Skip to content

Commit

Permalink
Update flakey polyfills and acceptance tests (#45313)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Jan 26, 2023
1 parent d1f18a5 commit 5f937d6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
32 changes: 20 additions & 12 deletions test/development/acceptance-app/ReactRefreshRegression.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,17 @@ describe('ReactRefreshRegression app', () => {
`
)

expect(
await session.evaluate(() => document.querySelector('p').textContent)
).toBe('0')
await check(
() => session.evaluate(() => document.querySelector('p').textContent),
'0'
)

await session.evaluate(() => document.querySelector('button').click())
expect(
await session.evaluate(() => document.querySelector('p').textContent)
).toBe('1')

await check(
() => session.evaluate(() => document.querySelector('p').textContent),
'1'
)

await session.patch(
'index.js',
Expand All @@ -204,13 +208,17 @@ describe('ReactRefreshRegression app', () => {
`
)

expect(
await session.evaluate(() => document.querySelector('p').textContent)
).toBe('Count: 1')
await check(
() => session.evaluate(() => document.querySelector('p').textContent),
'Count: 1'
)

await session.evaluate(() => document.querySelector('button').click())
expect(
await session.evaluate(() => document.querySelector('p').textContent)
).toBe('Count: 2')

await check(
() => session.evaluate(() => document.querySelector('p').textContent),
'Count: 2'
)

await cleanup()
})
Expand Down
3 changes: 2 additions & 1 deletion test/production/disable-fallback-polyfills/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ describe('Disable fallback polyfills', () => {
let next: NextInstance

function getFirstLoadSize(output: string) {
const firstLoadRe = /○ \/\s*(\d*) k?B\s*(?<firstLoad>.*) kB/
const firstLoadRe =
/○ \/.*? (?<size>\d.*?) [^\d]{2} (?<firstLoad>\d.*?) [^\d]{2}/
return Number(output.match(firstLoadRe).groups.firstLoad)
}

Expand Down

0 comments on commit 5f937d6

Please sign in to comment.