Skip to content

Commit cc42d01

Browse files
ruyadornoisaacs
authored andcommitted
test: add lib/config.js tests
1 parent 31a7de6 commit cc42d01

File tree

2 files changed

+728
-0
lines changed

2 files changed

+728
-0
lines changed
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
/* IMPORTANT
2+
* This snapshot file is auto-generated, but designed for humans.
3+
* It should be checked into source control and tracked carefully.
4+
* Re-generate by setting TAP_SNAPSHOT=1 and running tests.
5+
* Make sure to inspect the output below. Do not ignore changes!
6+
*/
7+
'use strict'
8+
exports[`test/lib/config.js TAP config edit --global > should write global config file 1`] = `
9+
;;;;
10+
; npm globalconfig file: /etc/npmrc
11+
; this is a simple ini-formatted file
12+
; lines that start with semi-colons are comments
13+
; run \`npm help 7 config\` for documentation of the various options
14+
;
15+
; Configs like \`@scope:registry\` map a scope to a given registry url.
16+
;
17+
; Configs like \`//<hostname>/:_authToken\` are auth that is restricted
18+
; to the registry host specified.
19+
20+
init.author.name=Foo
21+
22+
;;;;
23+
; all available options shown below with default values
24+
;;;;
25+
26+
27+
; init-author-name=
28+
; init-version=1.0.0
29+
; init.author.name=
30+
; init.version=1.0.0
31+
32+
`
33+
34+
exports[`test/lib/config.js TAP config edit > should write config file 1`] = `
35+
;;;;
36+
; npm userconfig file: ~/.npmrc
37+
; this is a simple ini-formatted file
38+
; lines that start with semi-colons are comments
39+
; run \`npm help 7 config\` for documentation of the various options
40+
;
41+
; Configs like \`@scope:registry\` map a scope to a given registry url.
42+
;
43+
; Configs like \`//<hostname>/:_authToken\` are auth that is restricted
44+
; to the registry host specified.
45+
46+
//registry.npmjs.org/:_authToken=0000000
47+
init.author.name=Foo
48+
sign-git-commit=true
49+
50+
;;;;
51+
; all available options shown below with default values
52+
;;;;
53+
54+
55+
; init-author-name=
56+
; init-version=1.0.0
57+
; init.author.name=
58+
; init.version=1.0.0
59+
60+
`
61+
62+
exports[`test/lib/config.js TAP config edit > should write config file 2`] = `
63+
;;;;
64+
; npm userconfig file: ~/.npmrc
65+
; this is a simple ini-formatted file
66+
; lines that start with semi-colons are comments
67+
; run \`npm help 7 config\` for documentation of the various options
68+
;
69+
; Configs like \`@scope:registry\` map a scope to a given registry url.
70+
;
71+
; Configs like \`//<hostname>/:_authToken\` are auth that is restricted
72+
; to the registry host specified.
73+
74+
75+
76+
;;;;
77+
; all available options shown below with default values
78+
;;;;
79+
80+
81+
; init-author-name=
82+
; init-version=1.0.0
83+
; init.author.name=
84+
; init.version=1.0.0
85+
86+
`
87+
88+
exports[`test/lib/config.js TAP config get no args > should list configs on config get no args 1`] = `
89+
; "cli" config from command line options
90+
91+
editor = "vi"
92+
global = false
93+
json = false
94+
long = false
95+
96+
; node bin location = /path/to/node
97+
; cwd = {CWD}
98+
; HOME = ~/
99+
; Run \`npm config ls -l\` to show all defaults.
100+
`
101+
102+
exports[`test/lib/config.js TAP config list --long > should list all configs 1`] = `
103+
; "default" config from default values
104+
105+
init-author-name = ""
106+
init-version = "1.0.0"
107+
init.author.name = ""
108+
init.version = "1.0.0"
109+
110+
; "cli" config from command line options
111+
112+
editor = "vi"
113+
global = false
114+
json = false
115+
long = true
116+
`
117+
118+
exports[`test/lib/config.js TAP config list > should list configs 1`] = `
119+
; "cli" config from command line options
120+
121+
editor = "vi"
122+
global = false
123+
json = false
124+
long = false
125+
126+
; node bin location = /path/to/node
127+
; cwd = {CWD}
128+
; HOME = ~/
129+
; Run \`npm config ls -l\` to show all defaults.
130+
`
131+
132+
exports[`test/lib/config.js TAP config list overrides > should list overriden configs 1`] = `
133+
; "cli" config from command line options
134+
135+
editor = "vi"
136+
global = false
137+
init.author.name = "Bar"
138+
json = false
139+
long = false
140+
141+
; "user" config from ~/.npmrc
142+
143+
; //private-reg.npmjs.org/:_authThoken = (protected) ; overridden by cli
144+
; init.author.name = "Foo" ; overridden by cli
145+
146+
; node bin location = /path/to/node
147+
; cwd = {CWD}
148+
; HOME = ~/
149+
; Run \`npm config ls -l\` to show all defaults.
150+
`

0 commit comments

Comments
 (0)