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

feat: devEngines #7766

Open
wants to merge 19 commits into
base: latest
Choose a base branch
from
Open
46 changes: 46 additions & 0 deletions tap-snapshots/test/lib/commands/install.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,52 @@
* Make sure to inspect the output below. Do not ignore changes!
*/
'use strict'
exports[`test/lib/commands/install.js TAP devEngines should show devEngines doesnt break engines > must match snapshot 1`] = `
silly config load:file:{CWD}/npmrc
silly config load:file:{CWD}/home/.npmrc
silly config load:file:{CWD}/global/etc/npmrc
verbose title npm
verbose argv "--fetch-retries" "0" "--cache" "{CWD}/cache" "--loglevel" "silly" "--color" "false" "--global" "true"
verbose logfile logs-max:10 dir:{CWD}/cache/_logs/{DATE}-
verbose logfile {CWD}/cache/_logs/{DATE}-debug-0.log
silly logfile done cleaning log files
silly packumentCache heap:{heap} maxSize:{maxSize} maxEntrySize:{maxEntrySize}
silly idealTree buildDeps
silly placeDep ROOT alpha@ OK for: want: file:../../prefix/alpha
warn EBADENGINE Unsupported engine {
warn EBADENGINE package: undefined,
warn EBADENGINE required: { node: '1.0.0' },
warn EBADENGINE current: { node: 'v1337.0.0', npm: '10.8.3' }
reggi marked this conversation as resolved.
Show resolved Hide resolved
warn EBADENGINE }
warn EBADENGINE Unsupported engine {
warn EBADENGINE package: undefined,
warn EBADENGINE required: { node: '1.0.0' },
warn EBADENGINE current: { node: 'v1337.0.0', npm: '10.8.3' }
warn EBADENGINE }
silly reify moves {}
silly ADD node_modules/alpha

added 1 package in {TIME}
`

exports[`test/lib/commands/install.js TAP devEngines should show devEngines has no effect on package install > must match snapshot 1`] = `
silly config load:file:{CWD}/npmrc
silly config load:file:{CWD}/home/.npmrc
silly config load:file:{CWD}/global/etc/npmrc
verbose title npm
verbose argv "--fetch-retries" "0" "--cache" "{CWD}/cache" "--loglevel" "silly" "--color" "false" "--global" "true"
verbose logfile logs-max:10 dir:{CWD}/cache/_logs/{DATE}-
verbose logfile {CWD}/cache/_logs/{DATE}-debug-0.log
silly logfile done cleaning log files
silly packumentCache heap:{heap} maxSize:{maxSize} maxEntrySize:{maxEntrySize}
silly idealTree buildDeps
silly placeDep ROOT alpha@ OK for: want: file:../../prefix/alpha
silly reify moves {}
silly ADD node_modules/alpha

added 1 package in {TIME}
`

exports[`test/lib/commands/install.js TAP devEngines should utilize devEngines 2x error case > must match snapshot 1`] = `
silly config load:file:{CWD}/npmrc
silly config load:file:{CWD}/prefix/.npmrc
Expand Down
37 changes: 37 additions & 0 deletions test/lib/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,4 +552,41 @@ t.test('devEngines', async t => {
)
t.matchSnapshot(joinedFullOutput())
})

await t.test('should show devEngines has no effect on package install', async t => {
const { npm, joinedFullOutput } = await loadMockNpm(t, {
globals,
prefixDir: {
alpha: {
'package.json': JSON.stringify({
name: 'alpha',
devEngines: { runtime: { name: 'node', version: '1.0.0' } },
}),
'index.js': 'console.log("this is alpha index")',
},
},
config: { global: true },
})
await npm.exec('install', ['./alpha'])
reggi marked this conversation as resolved.
Show resolved Hide resolved
t.matchSnapshot(joinedFullOutput())
})

await t.test('should show devEngines doesnt break engines', async t => {
const { npm, joinedFullOutput } = await loadMockNpm(t, {
globals,
prefixDir: {
alpha: {
'package.json': JSON.stringify({
name: 'alpha',
devEngines: { runtime: { name: 'node', version: '1.0.0' } },
engines: { node: '1.0.0' },
}),
'index.js': 'console.log("this is alpha index")',
},
},
config: { global: true },
})
await npm.exec('install', ['./alpha'])
t.matchSnapshot(joinedFullOutput())
})
})
Loading