|
1 | 1 | import { execAndWaitForOutputToMatch } from '../../../utils/process'; |
2 | 2 | import { updateJsonFile } from '../../../utils/project'; |
3 | 3 |
|
| 4 | +const ENV_NO_COLOR = { |
| 5 | + 'NO_COLOR': '1', |
| 6 | +}; |
| 7 | + |
4 | 8 | export default async function () { |
5 | 9 | const originalCIValue = process.env['CI']; |
6 | 10 |
|
7 | 11 | try { |
8 | 12 | // Should be enabled by default for local builds. |
9 | 13 | await configureTest('0' /** envCI */); |
10 | | - await execAndWaitForOutputToMatch('ng', ['cache', 'info'], /Effective Status\s*: Enabled/); |
| 14 | + await execAndWaitForOutputToMatch('ng', ['cache', 'info'], /Effective Status\s*: Enabled/, { |
| 15 | + ...process.env, |
| 16 | + ...ENV_NO_COLOR, |
| 17 | + }); |
11 | 18 |
|
12 | 19 | // Should be disabled by default for CI builds. |
13 | 20 | await configureTest('1' /** envCI */, { enabled: true }); |
14 | | - await execAndWaitForOutputToMatch('ng', ['cache', 'info'], /Effective Status\s*: Disabled/); |
| 21 | + await execAndWaitForOutputToMatch('ng', ['cache', 'info'], /Effective Status\s*: Disabled/, { |
| 22 | + ...process.env, |
| 23 | + ...ENV_NO_COLOR, |
| 24 | + }); |
15 | 25 |
|
16 | 26 | // Should be enabled by when environment is local and env is not CI. |
17 | 27 | await configureTest('0' /** envCI */, { environment: 'local' }); |
18 | | - await execAndWaitForOutputToMatch('ng', ['cache', 'info'], /Effective Status\s*: Enabled/); |
| 28 | + await execAndWaitForOutputToMatch('ng', ['cache', 'info'], /Effective Status\s*: Enabled/, { |
| 29 | + ...process.env, |
| 30 | + ...ENV_NO_COLOR, |
| 31 | + }); |
19 | 32 |
|
20 | 33 | // Should be disabled by when environment is local and env is CI. |
21 | 34 | await configureTest('1' /** envCI */, { environment: 'local' }); |
22 | | - await execAndWaitForOutputToMatch('ng', ['cache', 'info'], /Effective Status\s*: Disabled/); |
| 35 | + await execAndWaitForOutputToMatch('ng', ['cache', 'info'], /Effective Status\s*: Disabled/, { |
| 36 | + ...process.env, |
| 37 | + ...ENV_NO_COLOR, |
| 38 | + }); |
23 | 39 |
|
24 | 40 | // Effective status should be enabled when 'environment' is set to 'all' or 'ci'. |
25 | 41 | await configureTest('1' /** envCI */, { environment: 'all' }); |
26 | | - await execAndWaitForOutputToMatch('ng', ['cache', 'info'], /Effective Status\s*: Enabled/); |
| 42 | + await execAndWaitForOutputToMatch('ng', ['cache', 'info'], /Effective Status\s*: Enabled/, { |
| 43 | + ...process.env, |
| 44 | + ...ENV_NO_COLOR, |
| 45 | + }); |
27 | 46 |
|
28 | 47 | // Effective status should be enabled when 'environment' is set to 'ci' and run is in ci |
29 | 48 | await configureTest('1' /** envCI */, { environment: 'ci' }); |
30 | | - await execAndWaitForOutputToMatch('ng', ['cache', 'info'], /Effective Status\s*: Enabled/); |
| 49 | + await execAndWaitForOutputToMatch('ng', ['cache', 'info'], /Effective Status\s*: Enabled/, { |
| 50 | + ...process.env, |
| 51 | + ...ENV_NO_COLOR, |
| 52 | + }); |
31 | 53 |
|
32 | 54 | // Effective status should be disabled when 'enabled' is set to false |
33 | 55 | await configureTest('1' /** envCI */, { environment: 'all', enabled: false }); |
34 | | - await execAndWaitForOutputToMatch('ng', ['cache', 'info'], /Effective Status\s*: Disabled/); |
| 56 | + await execAndWaitForOutputToMatch('ng', ['cache', 'info'], /Effective Status\s*: Disabled/, { |
| 57 | + ...process.env, |
| 58 | + ...ENV_NO_COLOR, |
| 59 | + }); |
35 | 60 | } finally { |
36 | 61 | process.env['CI'] = originalCIValue; |
37 | 62 | } |
|
0 commit comments