@@ -75,7 +75,6 @@ const azureartifactsnugetorgNuGetConfig: string = `<?xml version="1.0" encoding=
75
75
const nugetConfigFile = path . join ( fakeSourcesDirForTesting , '../nuget.config' ) ;
76
76
77
77
process . env [ 'GITHUB_REPOSITORY' ] = 'OwnerName/repo' ;
78
- process . env [ 'RUNNER_TEMP' ] = fakeSourcesDirForTesting ;
79
78
import * as auth from '../src/authutil' ;
80
79
81
80
describe ( 'authutil tests' , ( ) => {
@@ -95,7 +94,9 @@ describe('authutil tests', () => {
95
94
it ( 'No existing config, sets up a full NuGet.config with URL and user/PAT for GPR' , async ( ) => {
96
95
process . env [ 'NUGET_AUTH_TOKEN' ] = 'TEST_FAKE_AUTH_TOKEN' ;
97
96
await auth . configAuthentication (
98
- 'https://nuget.pkg.github.com/OwnerName/index.json'
97
+ 'https://nuget.pkg.github.com/OwnerName/index.json' ,
98
+ '' ,
99
+ fakeSourcesDirForTesting
99
100
) ;
100
101
expect ( fs . existsSync ( nugetConfigFile ) ) . toBe ( true ) ;
101
102
expect (
@@ -107,7 +108,9 @@ describe('authutil tests', () => {
107
108
let thrown = false ;
108
109
try {
109
110
await auth . configAuthentication (
110
- 'https://nuget.pkg.github.com/OwnerName/index.json'
111
+ 'https://nuget.pkg.github.com/OwnerName/index.json' ,
112
+ '' ,
113
+ fakeSourcesDirForTesting
111
114
) ;
112
115
} catch {
113
116
thrown = true ;
@@ -119,7 +122,9 @@ describe('authutil tests', () => {
119
122
process . env [ 'NUGET_AUTH_TOKEN' ] = 'TEST_FAKE_AUTH_TOKEN' ;
120
123
process . env [ 'INPUT_OWNER' ] = 'otherorg' ;
121
124
await auth . configAuthentication (
122
- 'https://nuget.pkg.github.com/otherorg/index.json'
125
+ 'https://nuget.pkg.github.com/otherorg/index.json' ,
126
+ '' ,
127
+ fakeSourcesDirForTesting
123
128
) ;
124
129
expect ( fs . existsSync ( nugetConfigFile ) ) . toBe ( true ) ;
125
130
expect (
@@ -137,7 +142,9 @@ describe('authutil tests', () => {
137
142
let thrown = false ;
138
143
try {
139
144
await auth . configAuthentication (
140
- 'https://nuget.pkg.github.com/OwnerName/index.json'
145
+ 'https://nuget.pkg.github.com/OwnerName/index.json' ,
146
+ '' ,
147
+ fakeSourcesDirForTesting
141
148
) ;
142
149
} catch {
143
150
thrown = true ;
@@ -153,7 +160,9 @@ describe('authutil tests', () => {
153
160
) ;
154
161
fs . writeFileSync ( inputNuGetConfigPath , emptyNuGetConfig ) ;
155
162
await auth . configAuthentication (
156
- 'https://nuget.pkg.github.com/OwnerName/index.json'
163
+ 'https://nuget.pkg.github.com/OwnerName/index.json' ,
164
+ '' ,
165
+ fakeSourcesDirForTesting
157
166
) ;
158
167
expect ( fs . existsSync ( nugetConfigFile ) ) . toBe ( true ) ;
159
168
expect (
@@ -169,7 +178,9 @@ describe('authutil tests', () => {
169
178
) ;
170
179
fs . writeFileSync ( inputNuGetConfigPath , nugetorgNuGetConfig ) ;
171
180
await auth . configAuthentication (
172
- 'https://nuget.pkg.github.com/OwnerName/index.json'
181
+ 'https://nuget.pkg.github.com/OwnerName/index.json' ,
182
+ '' ,
183
+ fakeSourcesDirForTesting
173
184
) ;
174
185
expect ( fs . existsSync ( nugetConfigFile ) ) . toBe ( true ) ;
175
186
expect (
@@ -185,7 +196,9 @@ describe('authutil tests', () => {
185
196
) ;
186
197
fs . writeFileSync ( inputNuGetConfigPath , gprNuGetConfig ) ;
187
198
await auth . configAuthentication (
188
- 'https://nuget.pkg.github.com/OwnerName/index.json'
199
+ 'https://nuget.pkg.github.com/OwnerName/index.json' ,
200
+ '' ,
201
+ fakeSourcesDirForTesting
189
202
) ;
190
203
expect ( fs . existsSync ( nugetConfigFile ) ) . toBe ( true ) ;
191
204
expect (
@@ -201,7 +214,9 @@ describe('authutil tests', () => {
201
214
) ;
202
215
fs . writeFileSync ( inputNuGetConfigPath , gprnugetorgNuGetConfig ) ;
203
216
await auth . configAuthentication (
204
- 'https://nuget.pkg.github.com/OwnerName/index.json'
217
+ 'https://nuget.pkg.github.com/OwnerName/index.json' ,
218
+ '' ,
219
+ fakeSourcesDirForTesting
205
220
) ;
206
221
expect ( fs . existsSync ( nugetConfigFile ) ) . toBe ( true ) ;
207
222
expect (
@@ -216,7 +231,11 @@ describe('authutil tests', () => {
216
231
'nuget.config'
217
232
) ;
218
233
fs . writeFileSync ( inputNuGetConfigPath , twogprNuGetConfig ) ;
219
- await auth . configAuthentication ( 'https://nuget.pkg.github.com' ) ;
234
+ await auth . configAuthentication (
235
+ 'https://nuget.pkg.github.com' ,
236
+ '' ,
237
+ fakeSourcesDirForTesting
238
+ ) ;
220
239
expect ( fs . existsSync ( nugetConfigFile ) ) . toBe ( true ) ;
221
240
expect (
222
241
fs . readFileSync ( nugetConfigFile , { encoding : 'utf8' } )
@@ -233,7 +252,9 @@ describe('authutil tests', () => {
233
252
let thrown = false ;
234
253
try {
235
254
await auth . configAuthentication (
236
- 'https://nuget.pkg.github.com/OwnerName/index.json'
255
+ 'https://nuget.pkg.github.com/OwnerName/index.json' ,
256
+ '' ,
257
+ fakeSourcesDirForTesting
237
258
) ;
238
259
} catch {
239
260
thrown = true ;
@@ -255,7 +276,8 @@ describe('authutil tests', () => {
255
276
fs . writeFileSync ( inputNuGetConfigPath , gprNuGetConfig ) ;
256
277
await auth . configAuthentication (
257
278
'https://nuget.pkg.github.com/OwnerName/index.json' ,
258
- 'subfolder/nuget.config'
279
+ 'subfolder/nuget.config' ,
280
+ fakeSourcesDirForTesting
259
281
) ;
260
282
expect ( fs . existsSync ( nugetConfigFile ) ) . toBe ( true ) ;
261
283
expect (
@@ -271,7 +293,9 @@ describe('authutil tests', () => {
271
293
) ;
272
294
fs . writeFileSync ( inputNuGetConfigPath , azureartifactsNuGetConfig ) ;
273
295
await auth . configAuthentication (
274
- 'https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json'
296
+ 'https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json' ,
297
+ '' ,
298
+ fakeSourcesDirForTesting
275
299
) ;
276
300
expect ( fs . existsSync ( nugetConfigFile ) ) . toBe ( true ) ;
277
301
expect (
@@ -287,7 +311,9 @@ describe('authutil tests', () => {
287
311
) ;
288
312
fs . writeFileSync ( inputNuGetConfigPath , azureartifactsnugetorgNuGetConfig ) ;
289
313
await auth . configAuthentication (
290
- 'https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json'
314
+ 'https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json' ,
315
+ '' ,
316
+ fakeSourcesDirForTesting
291
317
) ;
292
318
expect ( fs . existsSync ( nugetConfigFile ) ) . toBe ( true ) ;
293
319
expect (
@@ -298,7 +324,9 @@ describe('authutil tests', () => {
298
324
it ( 'No existing config, sets up a full NuGet.config with URL and token for other source' , async ( ) => {
299
325
process . env [ 'NUGET_AUTH_TOKEN' ] = 'TEST_FAKE_AUTH_TOKEN' ;
300
326
await auth . configAuthentication (
301
- 'https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json'
327
+ 'https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json' ,
328
+ '' ,
329
+ fakeSourcesDirForTesting
302
330
) ;
303
331
expect ( fs . existsSync ( nugetConfigFile ) ) . toBe ( true ) ;
304
332
expect (
0 commit comments