1
1
import { promises as fs } from 'fs' ;
2
2
import * as path from 'path' ;
3
3
import { getGlobalVariable } from '../../../utils/env' ;
4
- import { mktempd } from '../../../utils/utils' ;
4
+ import { mockHome } from '../../../utils/utils' ;
5
5
import {
6
6
execAndCaptureError ,
7
7
execAndWaitForOutputToMatch ,
@@ -29,7 +29,6 @@ export default async function () {
29
29
{
30
30
...process . env ,
31
31
'SHELL' : '/bin/bash' ,
32
- 'HOME' : home ,
33
32
} ,
34
33
) ;
35
34
@@ -52,7 +51,6 @@ source <(ng completion script)
52
51
{
53
52
...process . env ,
54
53
'SHELL' : '/usr/bin/zsh' ,
55
- 'HOME' : home ,
56
54
} ,
57
55
) ;
58
56
@@ -77,7 +75,6 @@ source <(ng completion script)
77
75
{
78
76
...process . env ,
79
77
'SHELL' : '/bin/bash' ,
80
- 'HOME' : home ,
81
78
} ,
82
79
) ;
83
80
@@ -103,7 +100,6 @@ source <(ng completion script)
103
100
{
104
101
...process . env ,
105
102
'SHELL' : '/bin/bash' ,
106
- 'HOME' : home ,
107
103
} ,
108
104
) ;
109
105
@@ -129,7 +125,6 @@ source <(ng completion script)
129
125
{
130
126
...process . env ,
131
127
'SHELL' : '/bin/bash' ,
132
- 'HOME' : home ,
133
128
} ,
134
129
) ;
135
130
@@ -160,7 +155,6 @@ source <(ng completion script)
160
155
{
161
156
...process . env ,
162
157
'SHELL' : '/bin/bash' ,
163
- 'HOME' : home ,
164
158
} ,
165
159
) ;
166
160
@@ -196,7 +190,6 @@ source <(ng completion script)
196
190
{
197
191
...process . env ,
198
192
'SHELL' : '/usr/bin/zsh' ,
199
- 'HOME' : home ,
200
193
} ,
201
194
) ;
202
195
@@ -222,7 +215,6 @@ source <(ng completion script)
222
215
{
223
216
...process . env ,
224
217
'SHELL' : '/usr/bin/zsh' ,
225
- 'HOME' : home ,
226
218
} ,
227
219
) ;
228
220
@@ -248,7 +240,6 @@ source <(ng completion script)
248
240
{
249
241
...process . env ,
250
242
'SHELL' : '/usr/bin/zsh' ,
251
- 'HOME' : home ,
252
243
} ,
253
244
) ;
254
245
@@ -279,7 +270,6 @@ source <(ng completion script)
279
270
{
280
271
...process . env ,
281
272
'SHELL' : '/usr/bin/zsh' ,
282
- 'HOME' : home ,
283
273
} ,
284
274
) ;
285
275
@@ -322,7 +312,6 @@ source <(ng completion script)
322
312
const err = await execAndCaptureError ( 'ng' , [ 'completion' ] , {
323
313
...process . env ,
324
314
SHELL : undefined ,
325
- HOME : home ,
326
315
} ) ;
327
316
if ( ! err . message . includes ( '`$SHELL` environment variable not set.' ) ) {
328
317
throw new Error ( `Expected unset \`$SHELL\` error message, but got:\n\n${ err . message } ` ) ;
@@ -334,7 +323,6 @@ source <(ng completion script)
334
323
const err = await execAndCaptureError ( 'ng' , [ 'completion' ] , {
335
324
...process . env ,
336
325
SHELL : '/usr/bin/unknown' ,
337
- HOME : home ,
338
326
} ) ;
339
327
if ( ! err . message . includes ( 'Unknown `$SHELL` environment variable' ) ) {
340
328
throw new Error ( `Expected unknown \`$SHELL\` error message, but got:\n\n${ err . message } ` ) ;
@@ -346,7 +334,6 @@ source <(ng completion script)
346
334
const { stdout } = await execWithEnv ( 'ng' , [ 'completion' ] , {
347
335
...process . env ,
348
336
'SHELL' : '/usr/bin/zsh' ,
349
- 'HOME' : home ,
350
337
} ) ;
351
338
352
339
if ( stdout . includes ( 'there does not seem to be a global install of the Angular CLI' ) ) {
@@ -373,7 +360,6 @@ source <(ng completion script)
373
360
const { stdout } = await execWithEnv ( localCliBinary , [ 'completion' ] , {
374
361
...process . env ,
375
362
'SHELL' : '/usr/bin/zsh' ,
376
- 'HOME' : home ,
377
363
} ) ;
378
364
379
365
if ( stdout . includes ( 'there does not seem to be a global install of the Angular CLI' ) ) {
@@ -395,13 +381,3 @@ async function windowsTests(): Promise<void> {
395
381
) ;
396
382
}
397
383
}
398
-
399
- async function mockHome ( cb : ( home : string ) => Promise < void > ) : Promise < void > {
400
- const tempHome = await mktempd ( 'angular-cli-e2e-home-' ) ;
401
-
402
- try {
403
- await cb ( tempHome ) ;
404
- } finally {
405
- await fs . rm ( tempHome , { recursive : true , force : true } ) ;
406
- }
407
- }
0 commit comments