Skip to content

Commit 4ea59bb

Browse files
committed
build: add blocklist for material unit tests
Initially the blocklist has been removed because there were no remaining disabled tests that failed. Also the blocklist logic didn't work anymore because the `material-unit-tests` CI job now runs against `angular/components#master` with Bazel. 388578f tried to revert the removal of the blocklist in favor of a new upcoming breaking change with HammerJS, but the revert doesn't help since the blocklist still doesn't work with Bazel. In order to make the blocklist work with the unit tests running with Bazel, a PR has been submitted on the components repository. See: angular/components#16833. This commit updates the blocklist logic on the framework side to work with the new logic on the components repo side.
1 parent 10ea3a9 commit 4ea59bb

File tree

4 files changed

+61
-44
lines changed

4 files changed

+61
-44
lines changed

scripts/ci/run_angular_material_unit_tests.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ cd ${MATERIAL_REPO_TMP_DIR}
2121
# Note that it's not necessary to perform a yarn install, as Bazel performs its own yarn install.
2222
node ${angular_dir}/scripts/ci/update-deps-to-dist-packages.js ${MATERIAL_REPO_TMP_DIR}/package.json ${angular_dir}/dist/packages-dist-ivy-aot/
2323

24-
# Append the test blocklist into angular/material2's karma-test-shim.js.
25-
# This filters out known-failing tests because the goal is to prevent regressions.
26-
cat ${angular_dir}/tools/material-ci/angular_material_test_blocklist.js >> ./test/karma-test-shim.js
24+
# Copy the test blocklist into the "angular/components" repository. The components
25+
# repository automatically picks up the blocklist and disables the specified tests.
26+
cp ${angular_dir}/tools/material-ci/test-blocklist.ts ${MATERIAL_REPO_TMP_DIR}/test/
2727

2828
# Create a symlink for the Bazel binary installed through NPM, as running through Yarn introduces OOM errors.
2929
./scripts/circleci/setup_bazel_binary.sh

tools/material-ci/angular_material_test_blocklist.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

tools/material-ci/instructions.md

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
11
### Unit tests for Angular CDK/Material
2-
The unit tests from angular/material2 run on CircleCI under the `material-unit-tests` job.
3-
Known failing tests are skipped based on the blocklist in
4-
`tools/material-ci/angular_material_test_blocklist.js`. Whenever the root cause of a known failure
5-
is identified, the `notes` field for the corresponding tests should be updated. Whenever a failure
6-
is resolved, the corresponding tests should be removed from the blocklist.
2+
3+
Currently, all changes to Ivy are validated against the test suite of the
4+
`angular/components` repository. Known failing tests are skipped based on
5+
the blocklist in `tools/material-ci/test-blocklist.ts`.
6+
7+
Whenever the root cause of a known failure is identified, the `notes` field
8+
for the corresponding tests should be updated. Whenever a failure is resolved,
9+
the corresponding tests should be removed from the blocklist.
710

811
### Debugging
9-
To debug a failure, you need to work against the angular/material2 repo:
10-
1. Clone `angular/material2`
11-
2. Checkout the `ivy-2019` branch
12-
3. Run `yarn`
13-
4. Run `scripts/ivy/install-angular.sh path/to/local/angular/repo`
14-
5. Run `gulp test`
15-
16-
### Regenerating the blocklist
17-
If a problem has been fixed, you can regenerate the blocklist by:
18-
1. Clone `angular/material2`
19-
2. Checkout the `ivy-2019` branch
20-
3. Run `yarn`
21-
4. Run `scripts/ivy/install-angular.sh path/to/local/angular/repo`
22-
5. Run `gulp test`. Let it finish. It will take a few minutes.
23-
6. Run `scripts/ivy/generate-blocklist.js path/to/local/angular/repo`
24-
7. Copy the new blocklist from `dist/angular_material_test_blocklist.js`
12+
13+
Information on debugging can be found [here](../../docs/DEBUG_MATERIAL_IVY.md).
14+
15+
### Excluding new tests
16+
17+
In case there are any tests in the components test suite that fail due to
18+
recent changes in the framework and you want to exclude the tests temporarily,
19+
a new entry can be added to the `test-blocklist.ts` file.
20+
21+
Each property in the blocklist object corresponds to a test in the components
22+
repository. The name of the property **must** match the exact test name. Additionally
23+
it's **recommended** that every entry has a field with a note on why the test is disabled.
24+
25+
```ts
26+
export const testBlocklist: any = {
27+
'MatSlider should be able to drag thumb': {
28+
error: 'Cannot register event "dragstart".',
29+
notes: 'Breaking change where HammerJS module needs to be imported.'
30+
}
31+
}
32+
```

tools/material-ci/test-blocklist.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
9+
// clang-format off
10+
// tslint:disable
11+
12+
interface BlocklistEntry {
13+
/** Description on why the given test is disabled. */
14+
notes: string;
15+
/** Optional error that has been thrown in the test. */
16+
error?: string;
17+
}
18+
19+
/**
20+
* List of tests that should not run in the Angular component test suites. This should
21+
* be empty in the components repository, but the file will be overwritten if the framework
22+
* repository runs the Angular component test suites against the latest snapshots. This is
23+
* helpful because sometimes breaking changes that break individual tests land in the framework
24+
* repository. It should be possible to disable these tests until the component repository
25+
* migrated the broken tests.
26+
*/
27+
export const testBlocklist: {[testName: string]: BlocklistEntry} = {};
28+
29+
// clang-format on

0 commit comments

Comments
 (0)