Skip to content

Commit

Permalink
remove extra setup condition
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Mar 31, 2022
1 parent ee15c9d commit 5760a9f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 24 deletions.
17 changes: 0 additions & 17 deletions run-tests.js
Expand Up @@ -8,7 +8,6 @@ const fetch = vercelFetch(nodeFetch)
const { promisify } = require('util')
const { Sema } = require('async-sema')
const { spawn, exec: execOrig } = require('child_process')
const { createNextInstall } = require('./test/lib/create-next-install')
const glob = promisify(_glob)
const exec = promisify(execOrig)

Expand All @@ -33,9 +32,6 @@ const testFilters = {
const configuredTestTypes = Object.values(testFilters)

const cleanUpAndExit = async (code) => {
if (process.env.NEXT_TEST_STARTER) {
await fs.remove(process.env.NEXT_TEST_STARTER)
}
console.log(`exiting with code ${code}`)
process.exit(code)
}
Expand Down Expand Up @@ -210,19 +206,6 @@ async function main() {
)
})

if ((testType && testType !== 'unit') || hasIsolatedTests) {
// 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('Creating Next.js install for isolated tests')
const reactVersion = process.env.NEXT_TEST_REACT_VERSION || 'latest'
const testStarter = await createNextInstall({
react: reactVersion,
'react-dom': reactVersion,
})
process.env.NEXT_TEST_STARTER = testStarter
}

const sema = new Sema(concurrency, { capacity: testNames.length })
const jestPath = path.join(
path.dirname(require.resolve('jest-cli/package.json')),
Expand Down
8 changes: 1 addition & 7 deletions test/lib/next-modes/base.ts
Expand Up @@ -81,13 +81,7 @@ export class NextInstance {
`next-test-${Date.now()}-${(Math.random() * 1000) | 0}`
)

if (
process.env.NEXT_TEST_STARTER &&
!this.dependencies &&
!this.installCommand
) {
await fs.copy(process.env.NEXT_TEST_STARTER, this.testDir)
} else if (!skipIsolatedNext) {
if (!skipIsolatedNext) {
const reactVersion = process.env.NEXT_TEST_REACT_VERSION || 'latest'
const finalDependencies = {
react: reactVersion,
Expand Down

0 comments on commit 5760a9f

Please sign in to comment.