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

Merged
merged 3 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 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,24 @@
* Make sure to inspect the output below. Do not ignore changes!
*/
'use strict'
exports[`test/lib/commands/install.js TAP devEngines should not utilize devEngines if global 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
silly reify moves {}
silly ADD node_modules/alpha

added 1 package in {TIME}
`

exports[`test/lib/commands/install.js TAP devEngines should not utilize engines in root if devEngines is provided > must match snapshot 1`] = `
silly config load:file:{CWD}/npmrc
silly config load:file:{CWD}/prefix/.npmrc
Expand Down
29 changes: 29 additions & 0 deletions test/lib/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -687,4 +687,33 @@ t.test('devEngines', async t => {
t.ok(output.includes('EBADENGINE'))
t.ok(!output.includes('EBADDEVENGINES'))
})

t.test('should not utilize devEngines if global install', async t => {
reggi marked this conversation as resolved.
Show resolved Hide resolved
const { npm, joinedFullOutput } = await loadMockNpm(t, {
...mockArguments,
config: {
global: true,
},
reggi marked this conversation as resolved.
Show resolved Hide resolved
prefixDir: {
'package.json': JSON.stringify({
name: 'alpha',
bin: {
alpha: 'index.js',
},
devEngines: {
runtime: {
name: 'node',
version: '0.0.1',
},
},
}),
'index.js': 'console.log("this is alpha index")',
},
})
await npm.exec('install', ['.'])
const output = joinedFullOutput()
t.matchSnapshot(output)
t.ok(!output.includes('EBADENGINE'))
t.ok(!output.includes('EBADDEVENGINES'))
})
})
Loading