Skip to content

build: add blocklist to disable individual tests in the project #16833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ ts_library(
name = "angular_test_init",
testonly = True,
# This file *must* end with "spec" in order for "karma_web_test_suite" to load it.
srcs = ["angular-test-init-spec.ts"],
srcs = [
"angular-test-init-spec.ts",
"test-blocklist.ts",
],
deps = [
"@npm//@angular/core",
"@npm//@angular/platform-browser-dynamic",
Expand Down
14 changes: 14 additions & 0 deletions test/angular-test-init-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing';
import {testBlocklist} from './test-blocklist';

/*
* Common setup / initialization for all unit tests in Angular Material and CDK.
Expand Down Expand Up @@ -54,3 +55,16 @@ function patchTestBedToDestroyFixturesAfterEveryTest(testBedInstance: TestBed) {
// https://github.com/angular/angular/blob/master/packages/core/testing/src/before_each.ts#L25
afterEach(() => testBedInstance.resetTestingModule());
}


// Filter out any tests explicitly given in the blocklist. The blocklist is empty in the
// components repository, but the file will be overwritten if the framework repository runs
// the Angular component test suites against the latest snapshots. This is helpful because
// sometimes breaking changes that break individual tests land in the framework repository.
// It should be possible to disable these tests until the component repository migrated the
// broken tests once the breaking change is released.
(jasmine.getEnv() as any).configure({
specFilter: function(spec: jasmine.Spec) {
return !testBlocklist || !testBlocklist[spec.getFullName()];
}
});
17 changes: 17 additions & 0 deletions test/test-blocklist.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* @license
* Copyright Google LLC 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
*/

/**
* List of tests that should not run in the Angular component test suites. This should
* be empty in the components repository, but the file will be overwritten if the framework
* repository runs the Angular component test suites against the latest snapshots. This is
* helpful because sometimes breaking changes that break individual tests land in the framework
* repository. It should be possible to disable these tests until the component repository
* migrated the broken tests.
*/
export const testBlocklist: {[testName: string]: Object} = {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be BlocklistEntry like we have in Framework?

Copy link
Member Author

@devversion devversion Aug 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I decided not to do that as on the components side we are not interested in notes or error message but rather just in the list of disabled tests.

Happy to change though. I don't feel too strong 😄

Also there would be no benefit for us on the components side and framework side. Just duplication IMO

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whichever way is fine with me, we can leave it. Its a temporary piece anyway that we shouldn't need for a long time anyway.