diff options
author | Gar <gar+gh@danger.computer> | 2021-11-08 21:38:58 +0300 |
---|---|---|
committer | Gar <gar+gh@danger.computer> | 2021-11-09 18:18:30 +0300 |
commit | b8d608929f395d2d2fca4cb05905c5ef712c0faa (patch) | |
tree | b469ccb31cb4ac777dd73841d790eee892950509 /test/lib/commands/shrinkwrap.js | |
parent | 2039184189314aa17c3ae1df1447dc778eee0a74 (diff) |
chore: refactor pack tests
Uses the real npm object and doesn't mock anything.
PR-URL: https://github.com/npm/cli/pull/4018
Credit: @wraithgar
Close: #4018
Reviewed-by: @lukekarrys
Diffstat (limited to 'test/lib/commands/shrinkwrap.js')
-rw-r--r-- | test/lib/commands/shrinkwrap.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test/lib/commands/shrinkwrap.js b/test/lib/commands/shrinkwrap.js index efe7e5380..db4021abd 100644 --- a/test/lib/commands/shrinkwrap.js +++ b/test/lib/commands/shrinkwrap.js @@ -23,7 +23,7 @@ t.formatSnapshot = obj => // and make some assertions that should always be true. Sets // the results on t.context for use in child tests const shrinkwrap = async (t, testdir = {}, config = {}, mocks = {}) => { - const { Npm, logs } = mockNpm(t, mocks) + const { Npm, filteredLogs } = mockNpm(t, mocks) const npm = new Npm() await npm.load() @@ -39,8 +39,8 @@ const shrinkwrap = async (t, testdir = {}, config = {}, mocks = {}) => { const newFile = resolve(npm.localPrefix, 'npm-shrinkwrap.json') const oldFile = resolve(npm.localPrefix, 'package-lock.json') - const notices = logs.filter(([title]) => title === 'notice').map(([, , msg]) => msg) - const warnings = logs.filter(([title]) => title === 'warn').map(([, , msg]) => msg) + const notices = filteredLogs('notice') + const warnings = filteredLogs('warn') t.notOk(fs.existsSync(oldFile), 'package-lock is always deleted') t.same(warnings, [], 'no warnings') |