fix(@angular-devkit/build-angular): dont serve files on cwd (#12547)

This commit is contained in:
Filipe Silva 2018-10-10 20:12:08 +01:00 committed by vikerman
parent 916a616762
commit 431df79a1b
2 changed files with 13 additions and 0 deletions

View File

@ -227,6 +227,7 @@ export class DevServerBuilder implements Builder<DevServerBuilderOptions> {
disableHostCheck: options.disableHostCheck,
publicPath: servePath,
hot: options.hmr,
contentBase: false,
};
if (options.ssl) {

View File

@ -34,4 +34,16 @@ describe('Dev Server Builder', () => {
take(1),
).toPromise().then(done, done.fail);
}, 30000);
it(`doesn't serve files on the cwd directly`, async () => {
const res = await runTargetSpec(host, devServerTargetSpec).pipe(
tap((buildEvent) => expect(buildEvent.success).toBe(true)),
// When webpack-dev-server doesn't have `contentBase: false`, this will serve the repo README.
concatMap(() => from(request('http://localhost:4200/README.md'))),
take(1),
).toPromise();
expect(res).not.toContain('This file is automatically generated during release.');
expect(res).toContain('<title>HelloWorldApp</title>');
});
});