diff options
author | nlf <quitlahok@gmail.com> | 2021-02-18 00:38:06 +0300 |
---|---|---|
committer | nlf <quitlahok@gmail.com> | 2021-02-18 23:53:30 +0300 |
commit | 69e0c4e8cd684c475a4450c40dfb32c995061aea (patch) | |
tree | 03f2260fc5e7301423119a728f787fbe5509ef1a /test | |
parent | 00afa316195f2db903146110a07ffdaec9bb6aa2 (diff) |
throw an error when trying to dedupe in global modenlf/no-global-dedupe
PR-URL: https://github.com/npm/cli/pull/2716
Credit: @nlf
Close: #2716
Reviewed-by: @ljharb, @wraithgar
Diffstat (limited to 'test')
-rw-r--r-- | test/lib/dedupe.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/lib/dedupe.js b/test/lib/dedupe.js index ff2d2be53..b14185525 100644 --- a/test/lib/dedupe.js +++ b/test/lib/dedupe.js @@ -1,6 +1,21 @@ const { test } = require('tap') const requireInject = require('require-inject') +test('should throw in global mode', (t) => { + const dedupe = requireInject('../../lib/dedupe.js', { + '../../lib/npm.js': { + flatOptions: { + global: true, + }, + }, + }) + + dedupe([], er => { + t.match(er, { code: 'EDEDUPEGLOBAL' }, 'throws EDEDUPEGLOBAL') + t.end() + }) +}) + test('should remove dupes using Arborist', (t) => { const dedupe = requireInject('../../lib/dedupe.js', { '../../lib/npm.js': { |