Skip to content

Commit

Permalink
Fix "infer pnpm with example" test outside test suite (#43487)
Browse files Browse the repository at this point in the history
Fixes pnpm w/ example being the only test outside the test suite.

Before:
```ts
describe('create next app', () => {
  // ...
})

it('should infer pnpm as the package manager with example', () => { ... })
```

After:
```ts
describe('create next app', () => {
  // ...

  it('should infer pnpm as the package manager with example', () => { ... })
})
```


## Documentation / Examples

- [X] Make sure the linting passes by running `pnpm build && pnpm lint`
  • Loading branch information
maxproske authored Dec 1, 2022
1 parent f6106d2 commit 1bb0596
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions test/integration/create-next-app/index.test.ts
Original file line number Diff line number Diff line change
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 })
})
})
})

0 comments on commit 1bb0596

Please sign in to comment.