mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-15 10:11:50 +08:00
fix(@angular-devkit/build-angular): dont serve files on cwd (#12547)
This commit is contained in:
parent
916a616762
commit
431df79a1b
@ -227,6 +227,7 @@ export class DevServerBuilder implements Builder<DevServerBuilderOptions> {
|
||||
disableHostCheck: options.disableHostCheck,
|
||||
publicPath: servePath,
|
||||
hot: options.hmr,
|
||||
contentBase: false,
|
||||
};
|
||||
|
||||
if (options.ssl) {
|
||||
|
@ -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>');
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user