diff options
author | Ruy Adorno <ruyadorno@hotmail.com> | 2020-10-20 21:12:57 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2020-10-23 20:43:32 +0300 |
commit | cc42d01e5c921105f559a2bc7d080229ef1ba482 (patch) | |
tree | 1b4f9600e878811df90062bc23adba26df79ae9e /tap-snapshots | |
parent | 31a7de642a0f96657c81577b4887306fb00139b4 (diff) |
test: add lib/config.js tests
Diffstat (limited to 'tap-snapshots')
-rw-r--r-- | tap-snapshots/test-lib-config.js-TAP.test.js | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/tap-snapshots/test-lib-config.js-TAP.test.js b/tap-snapshots/test-lib-config.js-TAP.test.js new file mode 100644 index 000000000..1794dc4fa --- /dev/null +++ b/tap-snapshots/test-lib-config.js-TAP.test.js @@ -0,0 +1,150 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`test/lib/config.js TAP config edit --global > should write global config file 1`] = ` +;;;; +; npm globalconfig file: /etc/npmrc +; this is a simple ini-formatted file +; lines that start with semi-colons are comments +; run \`npm help 7 config\` for documentation of the various options +; +; Configs like \`@scope:registry\` map a scope to a given registry url. +; +; Configs like \`//<hostname>/:_authToken\` are auth that is restricted +; to the registry host specified. + +init.author.name=Foo + +;;;; +; all available options shown below with default values +;;;; + + +; init-author-name= +; init-version=1.0.0 +; init.author.name= +; init.version=1.0.0 + +` + +exports[`test/lib/config.js TAP config edit > should write config file 1`] = ` +;;;; +; npm userconfig file: ~/.npmrc +; this is a simple ini-formatted file +; lines that start with semi-colons are comments +; run \`npm help 7 config\` for documentation of the various options +; +; Configs like \`@scope:registry\` map a scope to a given registry url. +; +; Configs like \`//<hostname>/:_authToken\` are auth that is restricted +; to the registry host specified. + +//registry.npmjs.org/:_authToken=0000000 +init.author.name=Foo +sign-git-commit=true + +;;;; +; all available options shown below with default values +;;;; + + +; init-author-name= +; init-version=1.0.0 +; init.author.name= +; init.version=1.0.0 + +` + +exports[`test/lib/config.js TAP config edit > should write config file 2`] = ` +;;;; +; npm userconfig file: ~/.npmrc +; this is a simple ini-formatted file +; lines that start with semi-colons are comments +; run \`npm help 7 config\` for documentation of the various options +; +; Configs like \`@scope:registry\` map a scope to a given registry url. +; +; Configs like \`//<hostname>/:_authToken\` are auth that is restricted +; to the registry host specified. + + + +;;;; +; all available options shown below with default values +;;;; + + +; init-author-name= +; init-version=1.0.0 +; init.author.name= +; init.version=1.0.0 + +` + +exports[`test/lib/config.js TAP config get no args > should list configs on config get no args 1`] = ` +; "cli" config from command line options + +editor = "vi" +global = false +json = false +long = false + +; node bin location = /path/to/node +; cwd = {CWD} +; HOME = ~/ +; Run \`npm config ls -l\` to show all defaults. +` + +exports[`test/lib/config.js TAP config list --long > should list all configs 1`] = ` +; "default" config from default values + +init-author-name = "" +init-version = "1.0.0" +init.author.name = "" +init.version = "1.0.0" + +; "cli" config from command line options + +editor = "vi" +global = false +json = false +long = true +` + +exports[`test/lib/config.js TAP config list > should list configs 1`] = ` +; "cli" config from command line options + +editor = "vi" +global = false +json = false +long = false + +; node bin location = /path/to/node +; cwd = {CWD} +; HOME = ~/ +; Run \`npm config ls -l\` to show all defaults. +` + +exports[`test/lib/config.js TAP config list overrides > should list overriden configs 1`] = ` +; "cli" config from command line options + +editor = "vi" +global = false +init.author.name = "Bar" +json = false +long = false + +; "user" config from ~/.npmrc + +; //private-reg.npmjs.org/:_authThoken = (protected) ; overridden by cli +; init.author.name = "Foo" ; overridden by cli + +; node bin location = /path/to/node +; cwd = {CWD} +; HOME = ~/ +; Run \`npm config ls -l\` to show all defaults. +` |