Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Disable NG CLI TTY mode
test --action_env=NG_FORCE_TTY=false

# Make TypeScript compilation fast, by keeping a few copies of the compiler
# running as daemons, and cache SourceFile AST's to reduce parse time.
build --strategy=TypeScriptCompile=worker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
*/

import { Architect, BuilderRun } from '@angular-devkit/architect';
import { DevServerBuilderOutput } from '@angular-devkit/build-angular';
import fetch from 'node-fetch'; // tslint:disable-line:no-implicit-dependencies
import { mergeMap, take, timeout } from 'rxjs/operators';
import { createArchitect, host } from '../test-utils';

describe('Dev Server Builder inline critical CSS optimization', () => {
Expand All @@ -34,11 +34,18 @@ describe('Dev Server Builder inline critical CSS optimization', () => {
});

it('works', async () => {
const run = await architect.scheduleTarget(target, { browserTarget: 'app:build:production,inline-critical-css' });
const run = await architect.scheduleTarget(target, { browserTarget: 'app:build:production,inline-critical-css', port: 0 });
runs.push(run);
const output = await run.result as DevServerBuilderOutput;
expect(output.success).toBe(true);
const response = await fetch(`${output.baseUrl}/index.html`);
expect(await response.text()).toContain(`body{color:#000;}`);
}, 30000);

await run.output.pipe(
take(1),
timeout(39000),
mergeMap(async output => {
expect(output.success).toBe(true);
const response = await fetch(`${output.baseUrl}/index.html`);
expect(await response.text()).toContain(`body{color:#000;}`);
}),
).toPromise();

}, 40000);
});