Skip to content

Commit 60b8a1c

Browse files
serhalpndhoule
authored andcommitted
test: run npm ci in a project depending on netlify-cli
1 parent 9e4d0ea commit 60b8a1c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

e2e/install.e2e.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,11 @@ const itWithMockNpmRegistry = it.extend<{ registry: { address: string; cwd: stri
165165
})
166166

167167
type Test = { packageName: string }
168-
type InstallTest = Test & { install: [cmd: string, args: string[]]; lockfile: string }
168+
type InstallTest = Test & {
169+
install: [cmd: string, args: string[]]
170+
lockfile: string
171+
cleanInstall: [cmd: string, args: string[]]
172+
}
169173
type RunTest = Test & { run: [cmd: string, args: string[]] }
170174

171175
const installTests: [packageManager: string, config: InstallTest][] = [
@@ -174,6 +178,7 @@ const installTests: [packageManager: string, config: InstallTest][] = [
174178
{
175179
packageName: 'netlify-cli',
176180
install: ['npm', ['install', 'netlify-cli@testing']],
181+
cleanInstall: ['npm', ['ci']],
177182
lockfile: 'package-lock.json',
178183
},
179184
],
@@ -182,6 +187,7 @@ const installTests: [packageManager: string, config: InstallTest][] = [
182187
{
183188
packageName: 'netlify-cli',
184189
install: ['pnpm', ['add', 'netlify-cli@testing']],
190+
cleanInstall: ['pnpm', ['install', '--frozen-lockfile']],
185191
lockfile: 'pnpm-lock.yaml',
186192
},
187193
],
@@ -190,6 +196,7 @@ const installTests: [packageManager: string, config: InstallTest][] = [
190196
{
191197
packageName: 'netlify-cli',
192198
install: ['yarn', ['add', 'netlify-cli@testing']],
199+
cleanInstall: ['yarn', ['install', '--frozen-lockfile']],
193200
lockfile: 'yarn.lock',
194201
},
195202
],
@@ -214,6 +221,13 @@ describe.each(installTests)('%s → installs the cli and runs commands without e
214221
`Generated lock file ${config.lockfile} does not exist in ${cwd}`,
215222
).toBe(true)
216223

224+
// Regression test: ensure we don't trigger known `npm ci` bugs: https://github.com/npm/cli/issues/7622.
225+
await execa(...config.cleanInstall, {
226+
cwd,
227+
env: { npm_config_registry: registry.address },
228+
stdio: debug.enabled ? 'inherit' : 'ignore',
229+
})
230+
217231
const binary = path.resolve(path.join(cwd, `./node_modules/.bin/netlify${platform() === 'win32' ? '.cmd' : ''}`))
218232

219233
// Help

0 commit comments

Comments
 (0)