@@ -76,115 +76,102 @@ describe('authutil tests', () => {
7676 }
7777
7878 it ( 'Sets up npmrc for npmjs' , async ( ) => {
79- await auth . configAuthentication ( 'https://registry.npmjs.org/' , 'false' ) ;
79+ await auth . configAuthentication ( 'https://registry.npmjs.org/' ) ;
8080
8181 expect ( fs . statSync ( rcFile ) ) . toBeDefined ( ) ;
8282 const contents = fs . readFileSync ( rcFile , { encoding : 'utf8' } ) ;
8383 const rc = readRcFile ( rcFile ) ;
8484 expect ( rc [ 'registry' ] ) . toBe ( 'https://registry.npmjs.org/' ) ;
85- expect ( rc [ 'always-auth' ] ) . toBe ( 'false' ) ;
8685 } ) ;
8786
8887 it ( 'Appends trailing slash to registry' , async ( ) => {
89- await auth . configAuthentication ( 'https://registry.npmjs.org' , 'false' ) ;
88+ await auth . configAuthentication ( 'https://registry.npmjs.org' ) ;
9089
9190 expect ( fs . statSync ( rcFile ) ) . toBeDefined ( ) ;
9291 const rc = readRcFile ( rcFile ) ;
9392 expect ( rc [ 'registry' ] ) . toBe ( 'https://registry.npmjs.org/' ) ;
94- expect ( rc [ 'always-auth' ] ) . toBe ( 'false' ) ;
9593 } ) ;
9694
9795 it ( 'Configures scoped npm registries' , async ( ) => {
9896 process . env [ 'INPUT_SCOPE' ] = 'myScope' ;
99- await auth . configAuthentication ( 'https://registry.npmjs.org' , 'false' ) ;
97+ await auth . configAuthentication ( 'https://registry.npmjs.org' ) ;
10098
10199 expect ( fs . statSync ( rcFile ) ) . toBeDefined ( ) ;
102100 const rc = readRcFile ( rcFile ) ;
103101 expect ( rc [ '@myscope:registry' ] ) . toBe ( 'https://registry.npmjs.org/' ) ;
104- expect ( rc [ 'always-auth' ] ) . toBe ( 'false' ) ;
105102 } ) ;
106103
107104 it ( 'Automatically configures GPR scope' , async ( ) => {
108- await auth . configAuthentication ( 'npm.pkg.github.com' , 'false' ) ;
105+ await auth . configAuthentication ( 'npm.pkg.github.com' ) ;
109106
110107 expect ( fs . statSync ( rcFile ) ) . toBeDefined ( ) ;
111108 const rc = readRcFile ( rcFile ) ;
112109 expect ( rc [ '@ownername:registry' ] ) . toBe ( 'npm.pkg.github.com/' ) ;
113- expect ( rc [ 'always-auth' ] ) . toBe ( 'false' ) ;
114- } ) ;
115-
116- it ( 'Sets up npmrc for always-auth true' , async ( ) => {
117- await auth . configAuthentication ( 'https://registry.npmjs.org/' , 'true' ) ;
118- expect ( fs . statSync ( rcFile ) ) . toBeDefined ( ) ;
119- const rc = readRcFile ( rcFile ) ;
120- expect ( rc [ 'registry' ] ) . toBe ( 'https://registry.npmjs.org/' ) ;
121- expect ( rc [ 'always-auth' ] ) . toBe ( 'true' ) ;
122110 } ) ;
123111
124112 it ( 'is already set the NODE_AUTH_TOKEN export it' , async ( ) => {
125113 process . env . NODE_AUTH_TOKEN = 'foobar' ;
126- await auth . configAuthentication ( 'npm.pkg.github.com' , 'false' ) ;
114+ await auth . configAuthentication ( 'npm.pkg.github.com' ) ;
127115 expect ( fs . statSync ( rcFile ) ) . toBeDefined ( ) ;
128116 const rc = readRcFile ( rcFile ) ;
129117 expect ( rc [ '@ownername:registry' ] ) . toBe ( 'npm.pkg.github.com/' ) ;
130- expect ( rc [ 'always-auth' ] ) . toBe ( 'false' ) ;
131118 expect ( process . env . NODE_AUTH_TOKEN ) . toEqual ( 'foobar' ) ;
132119 } ) ;
133120
134121 it ( 'configAuthentication should overwrite non-scoped with non-scoped' , async ( ) => {
135122 fs . writeFileSync ( rcFile , 'registry=NNN' ) ;
136- await auth . configAuthentication ( 'https://registry.npmjs.org/' , 'true' ) ;
123+ await auth . configAuthentication ( 'https://registry.npmjs.org/' ) ;
137124 const contents = fs . readFileSync ( rcFile , { encoding : 'utf8' } ) ;
138125 expect ( contents ) . toBe (
139- `//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}${ os . EOL } registry=https://registry.npmjs.org/${ os . EOL } always-auth=true `
126+ `//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}${ os . EOL } registry=https://registry.npmjs.org/`
140127 ) ;
141128 } ) ;
142129
143130 it ( 'configAuthentication should overwrite only non-scoped' , async ( ) => {
144131 fs . writeFileSync ( rcFile , `registry=NNN${ os . EOL } @myscope:registry=MMM` ) ;
145- await auth . configAuthentication ( 'https://registry.npmjs.org/' , 'true' ) ;
132+ await auth . configAuthentication ( 'https://registry.npmjs.org/' ) ;
146133 const contents = fs . readFileSync ( rcFile , { encoding : 'utf8' } ) ;
147134 expect ( contents ) . toBe (
148- `@myscope:registry=MMM${ os . EOL } //registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}${ os . EOL } registry=https://registry.npmjs.org/${ os . EOL } always-auth=true `
135+ `@myscope:registry=MMM${ os . EOL } //registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}${ os . EOL } registry=https://registry.npmjs.org/`
149136 ) ;
150137 } ) ;
151138
152139 it ( 'configAuthentication should add non-scoped to scoped' , async ( ) => {
153140 fs . writeFileSync ( rcFile , '@myscope:registry=NNN' ) ;
154- await auth . configAuthentication ( 'https://registry.npmjs.org/' , 'true' ) ;
141+ await auth . configAuthentication ( 'https://registry.npmjs.org/' ) ;
155142 const contents = fs . readFileSync ( rcFile , { encoding : 'utf8' } ) ;
156143 expect ( contents ) . toBe (
157- `@myscope:registry=NNN${ os . EOL } //registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}${ os . EOL } registry=https://registry.npmjs.org/${ os . EOL } always-auth=true `
144+ `@myscope:registry=NNN${ os . EOL } //registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}${ os . EOL } registry=https://registry.npmjs.org/`
158145 ) ;
159146 } ) ;
160147
161148 it ( 'configAuthentication should overwrite scoped with scoped' , async ( ) => {
162149 process . env [ 'INPUT_SCOPE' ] = 'myscope' ;
163150 fs . writeFileSync ( rcFile , `@myscope:registry=NNN` ) ;
164- await auth . configAuthentication ( 'https://registry.npmjs.org/' , 'true' ) ;
151+ await auth . configAuthentication ( 'https://registry.npmjs.org/' ) ;
165152 const contents = fs . readFileSync ( rcFile , { encoding : 'utf8' } ) ;
166153 expect ( contents ) . toBe (
167- `//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}${ os . EOL } @myscope:registry=https://registry.npmjs.org/${ os . EOL } always-auth=true `
154+ `//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}${ os . EOL } @myscope:registry=https://registry.npmjs.org/`
168155 ) ;
169156 } ) ;
170157
171158 it ( 'configAuthentication should overwrite only scoped' , async ( ) => {
172159 process . env [ 'INPUT_SCOPE' ] = 'myscope' ;
173160 fs . writeFileSync ( rcFile , `registry=NNN${ os . EOL } @myscope:registry=MMM` ) ;
174- await auth . configAuthentication ( 'https://registry.npmjs.org/' , 'true' ) ;
161+ await auth . configAuthentication ( 'https://registry.npmjs.org/' ) ;
175162 const contents = fs . readFileSync ( rcFile , { encoding : 'utf8' } ) ;
176163 expect ( contents ) . toBe (
177- `registry=NNN${ os . EOL } //registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}${ os . EOL } @myscope:registry=https://registry.npmjs.org/${ os . EOL } always-auth=true `
164+ `registry=NNN${ os . EOL } //registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}${ os . EOL } @myscope:registry=https://registry.npmjs.org/`
178165 ) ;
179166 } ) ;
180167
181168 it ( 'configAuthentication should add scoped to non-scoped' , async ( ) => {
182169 process . env [ 'INPUT_SCOPE' ] = 'myscope' ;
183170 fs . writeFileSync ( rcFile , `registry=MMM` ) ;
184- await auth . configAuthentication ( 'https://registry.npmjs.org/' , 'true' ) ;
171+ await auth . configAuthentication ( 'https://registry.npmjs.org/' ) ;
185172 const contents = fs . readFileSync ( rcFile , { encoding : 'utf8' } ) ;
186173 expect ( contents ) . toBe (
187- `registry=MMM${ os . EOL } //registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}${ os . EOL } @myscope:registry=https://registry.npmjs.org/${ os . EOL } always-auth=true `
174+ `registry=MMM${ os . EOL } //registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}${ os . EOL } @myscope:registry=https://registry.npmjs.org/`
188175 ) ;
189176 } ) ;
190177
@@ -194,20 +181,20 @@ describe('authutil tests', () => {
194181 rcFile ,
195182 `@otherscope:registry=NNN${ os . EOL } @myscope:registry=MMM`
196183 ) ;
197- await auth . configAuthentication ( 'https://registry.npmjs.org/' , 'true' ) ;
184+ await auth . configAuthentication ( 'https://registry.npmjs.org/' ) ;
198185 const contents = fs . readFileSync ( rcFile , { encoding : 'utf8' } ) ;
199186 expect ( contents ) . toBe (
200- `@otherscope:registry=NNN${ os . EOL } //registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}${ os . EOL } @myscope:registry=https://registry.npmjs.org/${ os . EOL } always-auth=true `
187+ `@otherscope:registry=NNN${ os . EOL } //registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}${ os . EOL } @myscope:registry=https://registry.npmjs.org/`
201188 ) ;
202189 } ) ;
203190
204191 it ( 'configAuthentication should add scoped to another scoped' , async ( ) => {
205192 process . env [ 'INPUT_SCOPE' ] = 'myscope' ;
206193 fs . writeFileSync ( rcFile , `@otherscope:registry=MMM` ) ;
207- await auth . configAuthentication ( 'https://registry.npmjs.org/' , 'true' ) ;
194+ await auth . configAuthentication ( 'https://registry.npmjs.org/' ) ;
208195 const contents = fs . readFileSync ( rcFile , { encoding : 'utf8' } ) ;
209196 expect ( contents ) . toBe (
210- `@otherscope:registry=MMM${ os . EOL } //registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}${ os . EOL } @myscope:registry=https://registry.npmjs.org/${ os . EOL } always-auth=true `
197+ `@otherscope:registry=MMM${ os . EOL } //registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}${ os . EOL } @myscope:registry=https://registry.npmjs.org/`
211198 ) ;
212199 } ) ;
213200} ) ;
0 commit comments