Unverified Commit 7cb5577e authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

make test directories more unique (#29864)

I wouldn't believe it, but it actually happens that the first two test cases try to create their test directory at the same millisecond, resulting in a shared directory, which leads to conflicts.
parent e40785e1
...@@ -54,7 +54,10 @@ export class NextInstance { ...@@ -54,7 +54,10 @@ export class NextInstance {
const tmpDir = skipIsolatedNext const tmpDir = skipIsolatedNext
? path.join(__dirname, '../../tmp') ? path.join(__dirname, '../../tmp')
: process.env.NEXT_TEST_DIR || (await fs.realpath(os.tmpdir())) : process.env.NEXT_TEST_DIR || (await fs.realpath(os.tmpdir()))
this.testDir = path.join(tmpDir, `next-test-${Date.now()}`) this.testDir = path.join(
tmpDir,
`next-test-${Date.now()}-${(Math.random() * 1000) | 0}`
)
if (process.env.NEXT_TEST_STARTER && !this.dependencies) { if (process.env.NEXT_TEST_STARTER && !this.dependencies) {
await fs.copy(process.env.NEXT_TEST_STARTER, this.testDir) await fs.copy(process.env.NEXT_TEST_STARTER, this.testDir)
......
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