File size: 861 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
28
29
30
31
32
33
34
35
import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils'

describe('logging-incoming-request', () => {
  const { next } = nextTestSetup({
    files: __dirname,
    overrideFiles: {
      'next.config.js': `
        module.exports = {
          logging: {
            incomingRequests: false
          }
        }
      `,
    },
  })

  it('should handle disabled request logging', async () => {
    let response = await next.fetch('/foo')
    expect(response.status).toBe(200)

    response = await next.fetch('/hello')
    expect(response.status).toBe(200)

    // Wait for GET /foo to be logged
    await retry(() => {
      expect(next.cliOutput).not.toContain('GET /foo')
    })

    // Verify no requests were logged
    expect(next.cliOutput).not.toContain('GET /')
    expect(next.cliOutput).not.toContain('GET /hello')
  })
})