Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CNA tests more #57088

Merged
merged 2 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion test/integration/create-next-app/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ const examplePath = 'examples/basic-css'
const run = (args: string[], options: execa.Options) => {
const conf = new Conf({ projectName: 'create-next-app' })
conf.clear()
return execa('node', [cli].concat(args), options)
return execa('node', [cli].concat(args), {
...options,
env: {
...(options.env || {}),
NEXT_PRIVATE_TEST_VERSION: 'canary',
} as any,
})
}

describe('create next app', () => {
Expand Down
5 changes: 2 additions & 3 deletions test/integration/create-next-app/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ export const createNextApp = (
delete cloneEnv.RUN_ID
delete cloneEnv.BUILD_NUMBER

if (testVersion) {
cloneEnv.NEXT_PRIVATE_TEST_VERSION = testVersion
}
cloneEnv.NEXT_PRIVATE_TEST_VERSION = testVersion || 'canary'

return spawn('node', [cli].concat(args), {
...options,
env: {
Expand Down
17 changes: 14 additions & 3 deletions test/integration/create-next-app/package-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,29 @@ import { projectFilesShouldExist, shouldBeJavascriptProject } from './lib/utils'
const cli = require.resolve('create-next-app/dist/index.js')
const exampleRepo = 'https://github.com/vercel/next.js/tree/canary'
const examplePath = 'examples/basic-css'
const env = { ...process.env, COREPACK_ENABLE_STRICT: '0' }
const env = {
...process.env,
COREPACK_ENABLE_STRICT: '0',
NEXT_PRIVATE_TEST_VERSION: 'canary',
}

const run = (args: string[], options: execa.Options) => {
const conf = new Conf({ projectName: 'create-next-app' })
conf.clear()
console.log(`Running "create-next-app ${args.join(' ')}"`)
return execa('node', [cli].concat(args), { ...options, stdio: 'inherit' })
return execa('node', [cli].concat(args), {
...options,
stdio: 'inherit',
env: options.env || env,
})
}

const command = (cmd: string, args: string[]) => {
console.log(`Running command "${cmd} ${args.join(' ')}"`)
return execa(cmd, args, { stdio: 'inherit' })
return execa(cmd, args, {
stdio: 'inherit',
env,
})
}

it('should use npm as the package manager on supplying --use-npm', async () => {
Expand Down
2 changes: 0 additions & 2 deletions test/integration/create-next-app/templates-app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ import {
shouldBeTemplateProject,
spawnExitPromise,
} from './lib/utils'
//import { Span } from 'next/dist/trace'

import { useTempDir } from '../../lib/use-temp-dir'
import { fetchViaHTTP, findPort, killApp, launchApp } from 'next-test-utils'
import resolveFrom from 'resolve-from'
//import { createNextInstall } from '../../lib/create-next-install'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly here - was this intended?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah no need to keep the comment around as we have the TODO


const startsWithoutError = async (
appDir: string,
Expand Down
Loading