Skip to content

Commit e59797f

Browse files
committed
chore: adds devEngines global install test
1 parent 4fedafb commit e59797f

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

tap-snapshots/test/lib/commands/install.js.test.cjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@
55
* Make sure to inspect the output below. Do not ignore changes!
66
*/
77
'use strict'
8+
exports[`test/lib/commands/install.js TAP devEngines should not utilize devEngines if global install > must match snapshot 1`] = `
9+
silly config load:file:{CWD}/npmrc
10+
silly config load:file:{CWD}/home/.npmrc
11+
silly config load:file:{CWD}/global/etc/npmrc
12+
verbose title npm
13+
verbose argv "--fetch-retries" "0" "--cache" "{CWD}/cache" "--loglevel" "silly" "--color" "false" "--global" "true"
14+
verbose logfile logs-max:10 dir:{CWD}/cache/_logs/{DATE}-
15+
verbose logfile {CWD}/cache/_logs/{DATE}-debug-0.log
16+
silly logfile done cleaning log files
17+
silly packumentCache heap:{heap} maxSize:{maxSize} maxEntrySize:{maxEntrySize}
18+
silly idealTree buildDeps
19+
silly placeDep ROOT alpha@ OK for: want: file:../../prefix
20+
silly reify moves {}
21+
silly ADD node_modules/alpha
22+
23+
added 1 package in {TIME}
24+
`
25+
826
exports[`test/lib/commands/install.js TAP devEngines should not utilize engines in root if devEngines is provided > must match snapshot 1`] = `
927
silly config load:file:{CWD}/npmrc
1028
silly config load:file:{CWD}/prefix/.npmrc

test/lib/commands/install.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,4 +687,33 @@ t.test('devEngines', async t => {
687687
t.ok(output.includes('EBADENGINE'))
688688
t.ok(!output.includes('EBADDEVENGINES'))
689689
})
690+
691+
t.test('should not utilize devEngines if global install', async t => {
692+
const { npm, joinedFullOutput } = await loadMockNpm(t, {
693+
...mockArguments,
694+
config: {
695+
global: true,
696+
},
697+
prefixDir: {
698+
'package.json': JSON.stringify({
699+
name: 'alpha',
700+
bin: {
701+
alpha: 'index.js',
702+
},
703+
devEngines: {
704+
runtime: {
705+
name: 'node',
706+
version: '0.0.1',
707+
},
708+
},
709+
}),
710+
'index.js': 'console.log("this is alpha index")',
711+
},
712+
})
713+
await npm.exec('install', ['.'])
714+
const output = joinedFullOutput()
715+
t.matchSnapshot(output)
716+
t.ok(!output.includes('EBADENGINE'))
717+
t.ok(!output.includes('EBADDEVENGINES'))
718+
})
690719
})

0 commit comments

Comments
 (0)