Unverified Commit 1e860311 authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

Fix unisolated tests (#76018)

parent 1769fc29
...@@ -154,9 +154,11 @@ async function createNextInstall({ ...@@ -154,9 +154,11 @@ async function createNextInstall({
) )
if (beforeInstall !== undefined) { if (beforeInstall !== undefined) {
rootSpan.traceChild('beforeInstall').traceAsyncFn(async (span) => { await rootSpan
await beforeInstall(span, installDir) .traceChild('beforeInstall')
}) .traceAsyncFn(async (span) => {
await beforeInstall(span, installDir)
})
} }
if (installCommand) { if (installCommand) {
......
...@@ -156,6 +156,16 @@ export class NextInstance { ...@@ -156,6 +156,16 @@ export class NextInstance {
} }
} }
protected async beforeInstall(parentSpan: Span) {
await parentSpan.traceChild('writeInitialFiles').traceAsyncFn(async () => {
await this.writeInitialFiles()
})
await parentSpan.traceChild('writeOverrideFiles').traceAsyncFn(async () => {
await this.writeOverrideFiles()
})
}
protected async createTestDir({ protected async createTestDir({
skipInstall = false, skipInstall = false,
parentSpan, parentSpan,
...@@ -228,6 +238,8 @@ export class NextInstance { ...@@ -228,6 +238,8 @@ export class NextInstance {
2 2
) )
) )
await this.beforeInstall(parentSpan)
} else { } else {
if ( if (
process.env.NEXT_TEST_STARTER && process.env.NEXT_TEST_STARTER &&
...@@ -239,6 +251,11 @@ export class NextInstance { ...@@ -239,6 +251,11 @@ export class NextInstance {
await fs.cp(process.env.NEXT_TEST_STARTER, this.testDir, { await fs.cp(process.env.NEXT_TEST_STARTER, this.testDir, {
recursive: true, recursive: true,
}) })
require('console').log(
'created next.js install, writing test files'
)
await this.beforeInstall(parentSpan)
} else { } else {
const { tmpRepoDir } = await createNextInstall({ const { tmpRepoDir } = await createNextInstall({
parentSpan: rootSpan, parentSpan: rootSpan,
...@@ -250,22 +267,14 @@ export class NextInstance { ...@@ -250,22 +267,14 @@ export class NextInstance {
keepRepoDir: true, keepRepoDir: true,
beforeInstall: async (span, installDir) => { beforeInstall: async (span, installDir) => {
this.testDir = installDir this.testDir = installDir
await span require('console').log(
.traceChild('writeInitialFiles') 'created next.js install, writing test files'
.traceAsyncFn(async () => { )
await this.writeInitialFiles() await this.beforeInstall(span)
})
await span
.traceChild('writeOverrideFiles')
.traceAsyncFn(async () => {
await this.writeOverrideFiles()
})
}, },
}) })
this.tmpRepoDir = tmpRepoDir this.tmpRepoDir = tmpRepoDir
} }
require('console').log('created next.js install, writing test files')
} }
const testDirFiles = await fs.readdir(this.testDir) const testDirFiles = await fs.readdir(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