Skip to content

Commit

Permalink
fix NextConfig detection in createTestDir
Browse files Browse the repository at this point in the history
  • Loading branch information
ztanner committed Jul 9, 2024
1 parent 46a915e commit 057f92f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions test/lib/next-modes/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,12 @@ export class NextInstance {
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.')
)

if (existsSync(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`
Expand Down

0 comments on commit 057f92f

Please sign in to comment.