File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -122,5 +122,16 @@ describe('authutil tests', () => {
122
122
let rc = readRcFile ( rcFile ) ;
123
123
expect ( rc [ 'registry' ] ) . toBe ( 'https://registry.npmjs.org/' ) ;
124
124
expect ( rc [ 'always-auth' ] ) . toBe ( 'true' ) ;
125
- } ) ;
125
+ } )
126
+ it ( 'It is already set the NODE_AUTH_TOKEN export it ' , async ( ) => {
127
+ process . env . NODE_AUTH_TOKEN = 'foobar' ;
128
+ await auth . configAuthentication ( 'npm.pkg.github.com' , 'false' ) ;
129
+ expect ( fs . statSync ( rcFile ) ) . toBeDefined ( ) ;
130
+ let rc = readRcFile ( rcFile ) ;
131
+ expect ( rc [ '@ownername:registry' ] ) . toBe ( 'npm.pkg.github.com/' ) ;
132
+ expect ( rc [ 'always-auth' ] ) . toBe ( 'false' ) ;
133
+ dbg ( `${ JSON . stringify ( rc ) } ` ) ;
134
+ expect ( process . env . NODE_AUTH_TOKEN ) . toEqual ( 'foobar' ) ;
135
+
136
+ } )
126
137
} ) ;
Original file line number Diff line number Diff line change @@ -54,5 +54,5 @@ function writeRegistryToFile(
54
54
fs . writeFileSync ( fileLocation , newContents ) ;
55
55
core . exportVariable ( 'NPM_CONFIG_USERCONFIG' , fileLocation ) ;
56
56
// Export empty node_auth_token so npm doesn't complain about not being able to find it
57
- core . exportVariable ( 'NODE_AUTH_TOKEN' , 'XXXXX-XXXXX-XXXXX-XXXXX' ) ;
57
+ core . exportVariable ( 'NODE_AUTH_TOKEN' , process . env . NODE_AUTH_TOKEN || 'XXXXX-XXXXX-XXXXX-XXXXX' ) ;
58
58
}
You can’t perform that action at this time.
0 commit comments