Skip to content

Commit

Permalink
fix: race condition in CLI output in react-compiler test (#65909)
Browse files Browse the repository at this point in the history
the 'should show an experimental warning' test in
`react-compiler-test.ts` has been randomly flaking for me:

```
    Expected substring: "Experiments (use with caution)"
    Received string:    " ⚠ `experimental.ppr` has been defaulted to `true` because `__NEXT_EXPERIMENTAL_PPR` was set to `true` during testing.
     ⚠ `experimental.ppr` has been defaulted to `true` because `__NEXT_EXPERIMENTAL_PPR` was set to `true` during testing.
      ▲ Next.js 14.3.0-canary.69
      - Local:        http://localhost:40095
    "
```
when the actual CLI output is:
```
 ⚠ `experimental.ppr` has been defaulted to `true` because `__NEXT_EXPERIMENTAL_PPR` was set to `true` during testing.
 ⚠ `experimental.ppr` has been defaulted to `true` because `__NEXT_EXPERIMENTAL_PPR` was set to `true` during testing.
  ▲ Next.js 14.3.0-canary.69
  - Local:        http://localhost:40095
  - Experiments (use with caution):
    · reactCompiler
```
which indicates that we're reading the CLI output too early
  • Loading branch information
lubieowoce committed May 17, 2024
1 parent 48b91dc commit 8747e23
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/e2e/react-compiler/react-compiler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ describe.each(
})

it('should show an experimental warning', async () => {
expect(next.cliOutput).toContain('Experiments (use with caution)')
expect(next.cliOutput).toContain('reactCompiler')
await retry(() => {
expect(next.cliOutput).toContain('Experiments (use with caution)')
expect(next.cliOutput).toContain('reactCompiler')
})
})

it('should render', async () => {
Expand Down

0 comments on commit 8747e23

Please sign in to comment.