-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(@angular-devkit/build-angular): add initial dev-server builder h…
…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
1 parent
8238631
commit c9a002c
Showing
3 changed files
with
76 additions
and
46 deletions.
There are no files selected for viewing
46 changes: 0 additions & 46 deletions
46
packages/angular_devkit/build_angular/src/dev-server/common-js-warning_spec.ts
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
packages/angular_devkit/build_angular/src/dev-server/tests/options/hmr_spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'), | ||
}), | ||
); | ||
}); | ||
}); | ||
}); |
38 changes: 38 additions & 0 deletions
38
packages/angular_devkit/build_angular/src/dev-server/tests/options/live-reload_spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'), | ||
}), | ||
); | ||
}); | ||
}); | ||
}); |