diff options
author | Gar <gar+gh@danger.computer> | 2021-03-25 19:46:01 +0300 |
---|---|---|
committer | Ruy Adorno <ruyadorno@hotmail.com> | 2021-03-26 00:42:55 +0300 |
commit | 59271936d90fbd6956a41967119f578c0ba63db9 (patch) | |
tree | 7d98bef224d0f418432dea96d681bf12ffc9b2b4 /test | |
parent | 1415b4bdeeaabb6e0ba12b6b1b0cc56502bd64ab (diff) |
fix(config): tie save-exact/save-prefix together
Each affects the other
PR-URL: https://github.com/npm/cli/pull/2965
Credit: @wraithgar
Close: #2965
Reviewed-by: @nlf
Diffstat (limited to 'test')
-rw-r--r-- | test/lib/utils/config/definitions.js | 15 | ||||
-rw-r--r-- | test/lib/utils/config/flatten.js | 2 |
2 files changed, 15 insertions, 2 deletions
diff --git a/test/lib/utils/config/definitions.js b/test/lib/utils/config/definitions.js index 49e51ace1..0b80b34d5 100644 --- a/test/lib/utils/config/definitions.js +++ b/test/lib/utils/config/definitions.js @@ -760,3 +760,18 @@ t.test('save-prefix', t => { t.strictSame(flat, { savePrefix: '~1.2.3' }) t.end() }) + +t.test('save-exact', t => { + const obj = { + 'save-exact': true, + 'save-prefix': '~1.2.3', + } + const flat = {} + definitions['save-exact'] + .flatten('save-exact', { ...obj, 'save-exact': true }, flat) + t.strictSame(flat, { savePrefix: '' }) + definitions['save-exact'] + .flatten('save-exact', { ...obj, 'save-exact': false }, flat) + t.strictSame(flat, { savePrefix: '~1.2.3' }) + t.end() +}) diff --git a/test/lib/utils/config/flatten.js b/test/lib/utils/config/flatten.js index 6fc91b484..7e1356392 100644 --- a/test/lib/utils/config/flatten.js +++ b/test/lib/utils/config/flatten.js @@ -17,7 +17,6 @@ const obj = { const flat = flatten(obj) t.strictSame(flat, { saveType: 'dev', - saveExact: true, savePrefix: '', '@foobar:registry': 'https://foo.bar.com/', '//foo.bar.com:_authToken': 'foobarbazquuxasdf', @@ -30,7 +29,6 @@ t.strictSame(flat, { process.env.NODE = '/usr/local/bin/node.exe' flatten({ 'save-dev': false }, flat) t.strictSame(flat, { - saveExact: true, savePrefix: '', '@foobar:registry': 'https://foo.bar.com/', '//foo.bar.com:_authToken': 'foobarbazquuxasdf', |