mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
build: test cdk with bazel (#13575)
* build: test cdk with bazel * Add comment for bazel tsconfig files * CDK tsconfig sync with Bazel build tsconfig
This commit is contained in:
committed by
Andrew Seguin
parent
85f04db62a
commit
d128fffcd6
+7
-2
@@ -1,11 +1,16 @@
|
||||
package(default_visibility=["//visibility:public"])
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
|
||||
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
|
||||
# Common set-up for all Angular Material and CDK tests.
|
||||
ts_library(
|
||||
name = "angular_test_init",
|
||||
testonly = 1,
|
||||
testonly = True,
|
||||
deps = [
|
||||
"@angular//packages/core/testing",
|
||||
"@angular//packages/platform-browser-dynamic/testing",
|
||||
"@npm//@types/jasmine",
|
||||
],
|
||||
# This file *must* end with "spec" in order for ts_web_test to load it.
|
||||
srcs = ["angular-test-init-spec.ts"],
|
||||
)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting,
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
|
||||
/* Common setup / initialization for all unit tests in Angular Material and CDK. */
|
||||
|
||||
/*
|
||||
* Common setup / initialization for all unit tests in Angular Material and CDK.
|
||||
*/
|
||||
|
||||
const testBed = TestBed.initTestEnvironment(
|
||||
[BrowserDynamicTestingModule], platformBrowserDynamicTesting());
|
||||
@@ -31,7 +31,7 @@ patchTestBedToDestroyFixturesAfterEveryTest(testBed);
|
||||
* aforementioned errors were thrown, they would be reported for the wrong test (the test that's
|
||||
* about to start, not the test that just finished).
|
||||
*/
|
||||
function patchTestBedToDestroyFixturesAfterEveryTest(testBedInstance) {
|
||||
function patchTestBedToDestroyFixturesAfterEveryTest(testBedInstance: TestBed) {
|
||||
// Original resetTestingModule function of the TestBed.
|
||||
const _resetTestingModule = testBedInstance.resetTestingModule;
|
||||
|
||||
@@ -40,7 +40,7 @@ function patchTestBedToDestroyFixturesAfterEveryTest(testBedInstance) {
|
||||
// errors when destroying components are no longer causing Jasmine to fail.
|
||||
testBedInstance.resetTestingModule = function() {
|
||||
try {
|
||||
this._activeFixtures.forEach(fixture => fixture.destroy());
|
||||
this._activeFixtures.forEach((fixture: ComponentFixture<any>) => fixture.destroy());
|
||||
} finally {
|
||||
this._activeFixtures = [];
|
||||
// Regardless of errors or not, run the original reset testing module function.
|
||||
|
||||
Reference in New Issue
Block a user