next.js/test/e2e/app-dir/proxy-with-middleware/proxy-with-middleware.test.ts
proxy-with-middleware.test.ts30 lines783 B
import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils'

describe('proxy-with-middleware', () => {
  const { next, isNextDev, skipped } = nextTestSetup({
    files: __dirname,
    skipDeployment: true,
    skipStart: true,
  })

  if (skipped) {
    return
  }

  it('should error when both middleware and proxy files are detected', async () => {
    const message =
      'Both middleware file "./middleware.ts" and proxy file "./proxy.ts" are detected. Please use "./proxy.ts" only.'

    if (isNextDev) {
      await next.start().catch(() => {})
      await retry(async () => {
        expect(next.cliOutput).toContain(message)
      })
    } else {
      const { cliOutput } = await next.build()
      expect(cliOutput).toContain(message)
    }
  })
})
Quest for Codev2.0.0
/
SIGN IN