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

Fix "infer pnpm with example" test outside test suite #43487

Merged
merged 1 commit into from Dec 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
62 changes: 31 additions & 31 deletions test/integration/create-next-app/index.test.ts
Expand Up @@ -606,38 +606,38 @@ describe('create next app', () => {
projectFilesShouldExist({ cwd, projectName, files })
})
})
})

it('should infer pnpm as the package manager with example', async () => {
try {
await execa('pnpm', ['--version'])
} catch (_) {
// install pnpm if not available
await execa('npm', ['i', '-g', 'pnpm'])
}
it('should infer pnpm as the package manager with example', async () => {
try {
await execa('pnpm', ['--version'])
} catch (_) {
// install pnpm if not available
await execa('npm', ['i', '-g', 'pnpm'])
}

await useTempDir(async (cwd) => {
const projectName = 'infer-package-manager-npm'
const res = await run(
[
projectName,
'--js',
'--eslint',
'--example',
`${exampleRepo}/${examplePath}`,
],
{ cwd, env: { ...process.env, npm_config_user_agent: 'pnpm' } }
)

const files = [
'package.json',
'pages/index.tsx',
'.gitignore',
'pnpm-lock.yaml',
'node_modules/next',
]

expect(res.exitCode).toBe(0)
projectFilesShouldExist({ cwd, projectName, files })
await useTempDir(async (cwd) => {
const projectName = 'infer-package-manager-npm'
const res = await run(
[
projectName,
'--js',
'--eslint',
'--example',
`${exampleRepo}/${examplePath}`,
],
{ cwd, env: { ...process.env, npm_config_user_agent: 'pnpm' } }
)

const files = [
'package.json',
'pages/index.tsx',
'.gitignore',
'pnpm-lock.yaml',
'node_modules/next',
]

expect(res.exitCode).toBe(0)
projectFilesShouldExist({ cwd, projectName, files })
})
})
})