|
| 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 { Architect } from '@angular-devkit/architect'; |
| 9 | +import { logging } from '@angular-devkit/core'; |
| 10 | +import { createArchitect, host } from '../test-utils'; |
| 11 | + |
| 12 | +describe('Dev Server Builder commonjs warning', () => { |
| 13 | + const targetSpec = { project: 'app', target: 'serve' }; |
| 14 | + |
| 15 | + let architect: Architect; |
| 16 | + let logger: logging.Logger; |
| 17 | + let logs: string[]; |
| 18 | + |
| 19 | + beforeEach(async () => { |
| 20 | + await host.initialize().toPromise(); |
| 21 | + architect = (await createArchitect(host.root())).architect; |
| 22 | + |
| 23 | + // Create logger |
| 24 | + logger = new logging.Logger(''); |
| 25 | + logs = []; |
| 26 | + logger.subscribe(e => logs.push(e.message)); |
| 27 | + }); |
| 28 | + |
| 29 | + afterEach(async () => host.restore().toPromise()); |
| 30 | + |
| 31 | + it('should not show warning when using HMR', async () => { |
| 32 | + const run = await architect.scheduleTarget(targetSpec, { hmr: true }, { logger }); |
| 33 | + const output = await run.result; |
| 34 | + expect(output.success).toBe(true); |
| 35 | + expect(logs.join()).not.toContain('Warning'); |
| 36 | + await run.stop(); |
| 37 | + }); |
| 38 | + |
| 39 | + it('should not show warning when using live-reload', async () => { |
| 40 | + const run = await architect.scheduleTarget(targetSpec, { liveReload: true}, { logger }); |
| 41 | + const output = await run.result; |
| 42 | + expect(output.success).toBe(true); |
| 43 | + expect(logs.join()).not.toContain('Warning'); |
| 44 | + await run.stop(); |
| 45 | + }); |
| 46 | +}); |
0 commit comments