diff options
author | isaacs <i@izs.me> | 2021-04-01 20:06:33 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2021-04-01 20:46:09 +0300 |
commit | 7b177e43f3bfb558bcd8723cdb2166a3df19647a (patch) | |
tree | 81e17be890379285723e273320f7cbe6f35cb11f /test | |
parent | 61da39beb5373320e2b591b61ecd6596eeaba6ed (diff) |
Add a 'envExport' flag for config definitionsisaacs/add-env-export-false-flag-for-config-defs
It defaults to true, but setting it to any falsey value will tell
`@npmcli/config` not to export it into the environment, and will also
put a remark in the documentation that it is not exported.
PR-URL: https://github.com/npm/cli/pull/3014
Credit: @isaacs
Close: #3014
Reviewed-by: @nlf
Diffstat (limited to 'test')
-rw-r--r-- | test/lib/utils/config/definition.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/lib/utils/config/definition.js b/test/lib/utils/config/definition.js index 88a527db6..45f4c977a 100644 --- a/test/lib/utils/config/definition.js +++ b/test/lib/utils/config/definition.js @@ -25,6 +25,7 @@ t.test('basic definition', async t => { usage: '--key <key>', typeDescription: 'Number or String', description: 'just a test thingie', + envExport: true, }) t.matchSnapshot(def.describe(), 'human-readable description') @@ -119,6 +120,25 @@ t.test('basic definition', async t => { description: 'asdf', }) t.equal(optionalBool.usage, '--key') + + const noExported = new Definition('methane', { + envExport: false, + type: String, + typeDescription: 'Greenhouse Gas', + default: 'CH4', + description: ` + This is bad for the environment, for our children, do not put it there. + `, + }) + t.equal(noExported.envExport, false, 'envExport flag is false') + t.equal(noExported.describe(), `#### \`methane\` + +* Default: "CH4" +* Type: Greenhouse Gas + +This is bad for the environment, for our children, do not put it there. + +This value is not exported to the environment for child processes.`) }) t.test('missing fields', async t => { |