Skip to content

Commit

Permalink
Revert "Run CNA tests with Next.js from branch"
Browse files Browse the repository at this point in the history
This reverts commit d648565.
  • Loading branch information
timneutkens committed May 16, 2024
1 parent d648565 commit df5934d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 27 deletions.
25 changes: 4 additions & 21 deletions test/integration/create-next-app/package-manager/npm.test.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
import { trace } from 'next/dist/trace'
import {
DEFAULT_FILES,
FULL_EXAMPLE_PATH,
projectFilesShouldExist,
run,
useTempDir,
} from '../utils'
import { createNextInstall } from '../../../lib/create-next-install'

const lockFile = 'package-lock.json'
const files = [...DEFAULT_FILES, lockFile]

let nextInstall: Awaited<ReturnType<typeof createNextInstall>>
beforeAll(async () => {
nextInstall = await createNextInstall({
parentSpan: trace('test'),
keepRepoDir: Boolean(process.env.NEXT_TEST_SKIP_CLEANUP),
})
})

describe('create-next-app with package manager npm', () => {
it('should use npm for --use-npm flag', async () => {
await useTempDir(async (cwd) => {
Expand All @@ -34,7 +24,6 @@ describe('create-next-app with package manager npm', () => {
'--no-tailwind',
'--no-import-alias',
],
nextInstall.installDir,
{
cwd,
}
Expand Down Expand Up @@ -63,7 +52,6 @@ it('should use npm when user-agent is npm', async () => {
'--no-tailwind',
'--no-import-alias',
],
nextInstall.installDir,
{
cwd,
env: { npm_config_user_agent: 'npm' },
Expand All @@ -84,7 +72,6 @@ it('should use npm for --use-npm flag with example', async () => {
const projectName = 'use-npm-with-example'
const res = await run(
[projectName, '--use-npm', '--example', FULL_EXAMPLE_PATH],
nextInstall.installDir,
{ cwd }
)

Expand All @@ -100,14 +87,10 @@ it('should use npm for --use-npm flag with example', async () => {
it('should use npm when user-agent is npm with example', async () => {
await useTempDir(async (cwd) => {
const projectName = 'user-agent-npm-with-example'
const res = await run(
[projectName, '--example', FULL_EXAMPLE_PATH],
nextInstall.installDir,
{
cwd,
env: { npm_config_user_agent: 'npm' },
}
)
const res = await run([projectName, '--example', FULL_EXAMPLE_PATH], {
cwd,
env: { npm_config_user_agent: 'npm' },
})

expect(res.exitCode).toBe(0)
projectFilesShouldExist({
Expand Down
10 changes: 4 additions & 6 deletions test/integration/create-next-app/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,25 @@ export const DEFAULT_FILES = [
'node_modules/next',
]

export const run = async (
export const run = (
args: string[],
nextJSVersion: string,
options:
| execa.Options
| {
reject?: boolean
env?: Record<string, string>
}
) => {
return execa('node', [CNA_PATH].concat(args), {
) =>
execa('node', [CNA_PATH].concat(args), {
// tests with options.reject false are expected to exit(1) so don't inherit
stdio: options.reject === false ? 'pipe' : 'inherit',
...options,
env: {
...process.env,
...options.env,
NEXT_PRIVATE_TEST_VERSION: nextJSVersion,
NEXT_PRIVATE_TEST_VERSION: 'canary',
},
})
}

export const command = (cmd: string, args: string[]) =>
execa(cmd, args, {
Expand Down

0 comments on commit df5934d

Please sign in to comment.