Skip to content

Commit 202a364

Browse files
committed
more fixes
1 parent 4d89c0d commit 202a364

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

tests/prepare.mjs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,15 @@ const promises = fixtures.map((fixture) =>
113113
}
114114
output.stderr?.pipe(addPrefix()).pipe(process.stderr)
115115
return output.finally(async () => {
116-
const npmListPromise = execaCommand(
117-
packageManager?.startsWith('pnpm') ? 'pnpm list next' : 'npm list next',
118-
{ cwd, stdio: 'pipe', reject: false },
119-
)
120-
npmListPromise.stdout?.pipe(addPrefix()).pipe(process.stdout)
121-
npmListPromise.stderr?.pipe(addPrefix()).pipe(process.stderr)
122-
await npmListPromise
116+
if (process.env.DEBUG) {
117+
const npmListPromise = execaCommand(
118+
packageManager?.startsWith('pnpm') ? 'pnpm list next' : 'npm list next',
119+
{ cwd, stdio: 'pipe', reject: false },
120+
)
121+
npmListPromise.stdout?.pipe(addPrefix()).pipe(process.stdout)
122+
npmListPromise.stderr?.pipe(addPrefix()).pipe(process.stderr)
123+
await npmListPromise
124+
}
123125

124126
await setNextVersionInFixture(cwd, 'latest', {
125127
logPrefix: `[${fixture}] `,

tests/utils/fixture.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,23 @@ async function installDependencies(cwd: string) {
4343

4444
const { packageManager } = JSON.parse(await readFile(join(cwd, 'package.json'), 'utf8'))
4545
if (packageManager?.startsWith('pnpm')) {
46-
return execaCommand(`pnpm install --ignore-scripts --reporter=silent`, {
46+
await execaCommand(`pnpm install --ignore-scripts --reporter=silent`, {
4747
cwd,
4848
})
49+
} else {
50+
await execaCommand(
51+
`npm install --ignore-scripts --no-audit --progress=false --legacy-peer-deps`,
52+
{ cwd },
53+
)
54+
}
55+
56+
if (process.env.DEBUG) {
57+
await execaCommand(packageManager?.startsWith('pnpm') ? `pnpm list next` : 'npm list next', {
58+
cwd,
59+
stdio: 'inherit',
60+
reject: false,
61+
})
4962
}
50-
return execaCommand(
51-
`npm install --ignore-scripts --no-audit --progress=false --legacy-peer-deps`,
52-
{ cwd },
53-
)
5463
}
5564

5665
export const getFixtureSourceDirectory = (fixture: string) =>
@@ -150,8 +159,6 @@ export const createFixture = async (fixture: string, ctx: FixtureTestContext) =>
150159
)
151160

152161
await installDependencies(ctx.cwd)
153-
154-
await execaCommand(`npm list next`, { cwd: ctx.cwd, stdio: 'inherit' })
155162
} catch (error) {
156163
throw new Error(`could not prepare the fixture: ${fixture}. ${error}`)
157164
}

0 commit comments

Comments
 (0)