Skip to content

Commit c9a002c

Browse files
clydinalan-agius4
authored andcommitted
test(@angular-devkit/build-angular): add initial dev-server builder hmr and liveReload option tests
The CommonJS usage warning tests are moved to use the builder harness for both the `hmr` and `liveReload` options.
1 parent 8238631 commit c9a002c

File tree

3 files changed

+76
-46
lines changed

3 files changed

+76
-46
lines changed

packages/angular_devkit/build_angular/src/dev-server/common-js-warning_spec.ts

-46
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
import { serveWebpackBrowser } from '../../index';
9+
import {
10+
BASE_OPTIONS,
11+
DEV_SERVER_BUILDER_INFO,
12+
describeBuilder,
13+
setupBrowserTarget,
14+
} from '../setup';
15+
16+
describeBuilder(serveWebpackBrowser, DEV_SERVER_BUILDER_INFO, (harness) => {
17+
describe('Option: "hmr"', () => {
18+
beforeEach(() => {
19+
setupBrowserTarget(harness);
20+
});
21+
22+
it('should not show a CommonJS usage warning when enabled', async () => {
23+
harness.useTarget('serve', {
24+
...BASE_OPTIONS,
25+
hmr: true,
26+
});
27+
28+
const { result, logs } = await harness.executeOnce();
29+
30+
expect(result?.success).toBe(true);
31+
expect(logs).not.toContain(
32+
jasmine.objectContaining({
33+
message: jasmine.stringMatching('CommonJS or AMD dependencies'),
34+
}),
35+
);
36+
});
37+
});
38+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
import { serveWebpackBrowser } from '../../index';
9+
import {
10+
BASE_OPTIONS,
11+
DEV_SERVER_BUILDER_INFO,
12+
describeBuilder,
13+
setupBrowserTarget,
14+
} from '../setup';
15+
16+
describeBuilder(serveWebpackBrowser, DEV_SERVER_BUILDER_INFO, (harness) => {
17+
describe('Option: "liveReload"', () => {
18+
beforeEach(() => {
19+
setupBrowserTarget(harness);
20+
});
21+
22+
it('should not show a CommonJS usage warning when enabled', async () => {
23+
harness.useTarget('serve', {
24+
...BASE_OPTIONS,
25+
liveReload: true,
26+
});
27+
28+
const { result, logs } = await harness.executeOnce();
29+
30+
expect(result?.success).toBe(true);
31+
expect(logs).not.toContain(
32+
jasmine.objectContaining({
33+
message: jasmine.stringMatching('CommonJS or AMD dependencies'),
34+
}),
35+
);
36+
});
37+
});
38+
});

0 commit comments

Comments
 (0)