File size: 711 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { nextTestSetup } from 'e2e-utils'
import stripAnsi from 'strip-ansi'

describe('build-error-logs', () => {
  const { next, isTurbopack } = nextTestSetup({
    files: __dirname,
  })

  it('should only log error a single time', async () => {
    await next.fetch('/')
    const output = stripAnsi(next.cliOutput)

    expect(output).toContain('Module not found')

    const moduleNotFoundLogs = output
      .split('\n')
      .filter((line) => line.includes('Module not found'))

    if (isTurbopack) {
      expect(moduleNotFoundLogs).toHaveLength(1)
    } else {
      // FIXME: next with webpack still logs the same error too many times
      expect(moduleNotFoundLogs).toHaveLength(3)
    }
  })
})