|
9 | 9 | import { Architect } from '@angular-devkit/architect';
|
10 | 10 | import { TestLogger } from '@angular-devkit/architect/testing';
|
11 | 11 | import { join, virtualFs } from '@angular-devkit/core';
|
12 |
| -import { debounceTime, takeWhile, tap } from 'rxjs/operators'; |
| 12 | +import { timer } from 'rxjs'; |
| 13 | +import { debounceTime, map, switchMap, takeWhile, tap } from 'rxjs/operators'; |
13 | 14 | import { browserBuild, createArchitect, host, outputPath } from '../utils';
|
14 | 15 |
|
15 | 16 |
|
@@ -140,15 +141,14 @@ describe('Browser Builder Web Worker support', () => {
|
140 | 141 | const workerPath = join(outputPath, '0.worker.js');
|
141 | 142 | let workerContent = '';
|
142 | 143 |
|
143 |
| - const run = await architect.scheduleTarget(target, overrides); |
144 |
| - await run.output.pipe( |
145 |
| - // Wait for files to be written to disk. |
146 |
| - // FIXME: Not quite sure why such a long 'debounceTime' is needed. |
147 |
| - // Anything under `2500` is a constant failure locally when using |
148 |
| - // 'fdescribe' and this tests doesn't run as first one and is also rather flaky on CI. |
149 |
| - // It seems that the outputted files contents don't get updated in time. |
150 |
| - debounceTime(2500), |
151 |
| - tap((buildEvent) => expect(buildEvent.success).toBe(true, 'build should succeed')), |
| 144 | + // The current linux-based CI environments may not fully settled in regards to filesystem |
| 145 | + // changes from previous tests which reuse the same directory and fileset. |
| 146 | + // The initial delay helps mitigate false positive rebuild triggers in such scenarios. |
| 147 | + const { run } = await timer(1000).pipe( |
| 148 | + switchMap(() => architect.scheduleTarget(target, overrides)), |
| 149 | + switchMap(run => run.output.pipe(map(output => ({ run, output })))), |
| 150 | + debounceTime(500), |
| 151 | + tap(({ output }) => expect(output.success).toBe(true, 'build should succeed')), |
152 | 152 | tap(() => {
|
153 | 153 | switch (phase) {
|
154 | 154 | case 1:
|
|
0 commit comments