Unverified Commit 92efb20e authored by Zack Tanner's avatar Zack Tanner Committed by GitHub

fix NextConfig detection in createTestDir (#67609)

We were creating a `next.config.js` file which conflicts with an
existing `next.config.ts` file, since the next config detection wasn't
properly looking at files in the test dir.


[x-ref](https://github.com/vercel/next.js/actions/runs/9862195913/job/27233838936)
parent 46a915ea
...@@ -234,14 +234,12 @@ export class NextInstance { ...@@ -234,14 +234,12 @@ export class NextInstance {
await this.writeInitialFiles() await this.writeInitialFiles()
}) })
let nextConfigFile = Object.keys(this.files).find((file) => const testDirFiles = await fs.readdir(this.testDir)
let nextConfigFile = testDirFiles.find((file) =>
file.startsWith('next.config.') file.startsWith('next.config.')
) )
if (existsSync(path.join(this.testDir, 'next.config.js'))) {
nextConfigFile = 'next.config.js'
}
if (nextConfigFile && this.nextConfig) { if (nextConfigFile && this.nextConfig) {
throw new Error( throw new Error(
`nextConfig provided on "createNext()" and as a file "${nextConfigFile}", use one or the other to continue` `nextConfig provided on "createNext()" and as a file "${nextConfigFile}", use one or the other to continue`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment