Skip to content

Commit

Permalink
chore(test): set COREPACK_ENABLE_STRICT: 0 for create-next-app tests (
Browse files Browse the repository at this point in the history
#56955)

I think some of the runners are missing `yarn` globally installed so its attempting to install with corepack. But the default behavior of corepack is to use the repo version (pnpm in this case) so running `yarn` will error. This PR disables corepack strict mode to avoid that problem.
  • Loading branch information
styfle authored Oct 17, 2023
1 parent 17553c5 commit 6ed4fdd
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions test/integration/create-next-app/package-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ 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 run = (args: string[], options: execa.Options) => {
const conf = new Conf({ projectName: 'create-next-app' })
Expand All @@ -41,6 +42,7 @@ it('should use npm as the package manager on supplying --use-npm', async () => {
],
{
cwd,
env,
}
)

Expand All @@ -62,7 +64,7 @@ it('should use npm as the package manager on supplying --use-npm with example',
'--example',
`${exampleRepo}/${examplePath}`,
],
{ cwd }
{ cwd, env }
)

expect(res.exitCode).toBe(0)
Expand Down Expand Up @@ -96,6 +98,7 @@ it('should use Yarn as the package manager on supplying --use-yarn', async () =>
],
{
cwd,
env,
}
)

Expand Down Expand Up @@ -139,7 +142,7 @@ it('should use Yarn as the package manager on supplying --use-yarn with example'
'--example',
`${exampleRepo}/${examplePath}`,
],
{ cwd }
{ cwd, env }
)

expect(res.exitCode).toBe(0)
Expand Down Expand Up @@ -173,6 +176,7 @@ it('should use pnpm as the package manager on supplying --use-pnpm', async () =>
],
{
cwd,
env,
}
)

Expand Down Expand Up @@ -216,7 +220,7 @@ it('should use pnpm as the package manager on supplying --use-pnpm with example'
'--example',
`${exampleRepo}/${examplePath}`,
],
{ cwd }
{ cwd, env }
)

expect(res.exitCode).toBe(0)
Expand Down Expand Up @@ -250,6 +254,7 @@ it('should use Bun as the package manager on supplying --use-bun', async () => {
],
{
cwd,
env,
}
)

Expand Down Expand Up @@ -289,7 +294,7 @@ it('should use Bun as the package manager on supplying --use-bun with example',
'--example',
`${exampleRepo}/${examplePath}`,
],
{ cwd }
{ cwd, env }
)

expect(res.exitCode).toBe(0)
Expand Down Expand Up @@ -322,7 +327,7 @@ it('should infer npm as the package manager', async () => {
],
{
cwd,
env: { ...process.env, npm_config_user_agent: 'npm' },
env: { ...env, npm_config_user_agent: 'npm' },
}
)

Expand Down Expand Up @@ -352,7 +357,7 @@ it('should infer npm as the package manager with example', async () => {
'--example',
`${exampleRepo}/${examplePath}`,
],
{ cwd, env: { ...process.env, npm_config_user_agent: 'npm' } }
{ cwd, env: { ...env, npm_config_user_agent: 'npm' } }
)

const files = [
Expand Down Expand Up @@ -394,7 +399,7 @@ it('should infer yarn as the package manager', async () => {
],
{
cwd,
env: { ...process.env, npm_config_user_agent: 'yarn' },
env: { ...env, npm_config_user_agent: 'yarn' },
}
)

Expand Down Expand Up @@ -435,7 +440,7 @@ it('should infer yarn as the package manager with example', async () => {
'--example',
`${exampleRepo}/${examplePath}`,
],
{ cwd, env: { ...process.env, npm_config_user_agent: 'yarn' } }
{ cwd, env: { ...env, npm_config_user_agent: 'yarn' } }
)

const files = [
Expand Down Expand Up @@ -477,7 +482,7 @@ it('should infer pnpm as the package manager', async () => {
],
{
cwd,
env: { ...process.env, npm_config_user_agent: 'pnpm' },
env: { ...env, npm_config_user_agent: 'pnpm' },
}
)

Expand Down Expand Up @@ -518,7 +523,7 @@ it('should infer pnpm as the package manager with example', async () => {
'--example',
`${exampleRepo}/${examplePath}`,
],
{ cwd, env: { ...process.env, npm_config_user_agent: 'pnpm' } }
{ cwd, env: { ...env, npm_config_user_agent: 'pnpm' } }
)

const files = [
Expand Down Expand Up @@ -556,7 +561,7 @@ it('should infer Bun as the package manager', async () => {
],
{
cwd,
env: { ...process.env, npm_config_user_agent: 'bun' },
env: { ...env, npm_config_user_agent: 'bun' },
}
)

Expand Down Expand Up @@ -593,7 +598,7 @@ it('should infer Bun as the package manager with example', async () => {
'--example',
`${exampleRepo}/${examplePath}`,
],
{ cwd, env: { ...process.env, npm_config_user_agent: 'bun' } }
{ cwd, env: { ...env, npm_config_user_agent: 'bun' } }
)

const files = [
Expand Down

0 comments on commit 6ed4fdd

Please sign in to comment.