diff --git a/test/lib/next-modes/base.ts b/test/lib/next-modes/base.ts index f6d2d930226..2e9b7432f9c 100644 --- a/test/lib/next-modes/base.ts +++ b/test/lib/next-modes/base.ts @@ -178,10 +178,14 @@ export class NextInstance { } } - const nextConfigFile = Object.keys(this.files).find((file) => + let nextConfigFile = Object.keys(this.files).find((file) => file.startsWith('next.config.') ) + if (await fs.pathExists(path.join(this.testDir, 'next.config.js'))) { + nextConfigFile = 'next.config.js' + } + if (nextConfigFile && this.nextConfig) { throw new Error( `nextConfig provided on "createNext()" and as a file "${nextConfigFile}", use one or the other to continue`