Skip to content

Commit

Permalink
test(@angular-devkit/build-angular): add initial dev-server builder h…
Browse files Browse the repository at this point in the history
…mr and liveReload option tests

The CommonJS usage warning tests are moved to use the builder harness for both the `hmr` and `liveReload` options.
  • Loading branch information
clydin authored and alan-agius4 committed Apr 7, 2021
1 parent 8238631 commit c9a002c
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 46 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { serveWebpackBrowser } from '../../index';
import {
BASE_OPTIONS,
DEV_SERVER_BUILDER_INFO,
describeBuilder,
setupBrowserTarget,
} from '../setup';

describeBuilder(serveWebpackBrowser, DEV_SERVER_BUILDER_INFO, (harness) => {
describe('Option: "hmr"', () => {
beforeEach(() => {
setupBrowserTarget(harness);
});

it('should not show a CommonJS usage warning when enabled', async () => {
harness.useTarget('serve', {
...BASE_OPTIONS,
hmr: true,
});

const { result, logs } = await harness.executeOnce();

expect(result?.success).toBe(true);
expect(logs).not.toContain(
jasmine.objectContaining({
message: jasmine.stringMatching('CommonJS or AMD dependencies'),
}),
);
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { serveWebpackBrowser } from '../../index';
import {
BASE_OPTIONS,
DEV_SERVER_BUILDER_INFO,
describeBuilder,
setupBrowserTarget,
} from '../setup';

describeBuilder(serveWebpackBrowser, DEV_SERVER_BUILDER_INFO, (harness) => {
describe('Option: "liveReload"', () => {
beforeEach(() => {
setupBrowserTarget(harness);
});

it('should not show a CommonJS usage warning when enabled', async () => {
harness.useTarget('serve', {
...BASE_OPTIONS,
liveReload: true,
});

const { result, logs } = await harness.executeOnce();

expect(result?.success).toBe(true);
expect(logs).not.toContain(
jasmine.objectContaining({
message: jasmine.stringMatching('CommonJS or AMD dependencies'),
}),
);
});
});
});

0 comments on commit c9a002c

Please sign in to comment.