Skip to content

Commit

Permalink
Create shared Next.js install dir for all non-unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
unstubbable committed Jul 25, 2024
1 parent 4e50a01 commit 517b848
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions run-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,21 +398,16 @@ ${tests.map((t) => t.file).join('\n')}
${ENDGROUP}`)
console.log(`total: ${tests.length}`)

const hasIsolatedTests = tests.some((test) => {
return configuredTestTypes.some(
(type) => typeof type === 'string' && test.file.startsWith(type)
)
})

if (
!options.dry &&
process.env.NEXT_TEST_MODE !== 'deploy' &&
((options.type && options.type !== 'unit') || hasIsolatedTests)
((options.type && options.type !== 'unit') ||
tests.some((test) => !testFilters.unit.test(test.file)))
) {
// for isolated next tests: e2e, dev, prod we create
// a starter Next.js install to re-use to speed up tests
// to avoid having to run yarn each time
console.log(`${GROUP}Creating Next.js install for isolated tests`)
// For isolated next tests (e2e, dev, prod) and integration tests we create
// a starter Next.js install to re-use to speed up tests to avoid having to
// run `pnpm install` each time.
console.log(`${GROUP}Creating shared Next.js install`)
const reactVersion = process.env.NEXT_TEST_REACT_VERSION || '19.0.0-rc.0'
const { installDir, pkgPaths, tmpRepoDir } = await createNextInstall({
parentSpan: mockTrace(),
Expand Down

0 comments on commit 517b848

Please sign in to comment.