angular-cn/goldens
Paul Gschwendtner a8978ebf8e build: ts-circular-deps tool should normalize golden (#36505)
Currently the golden output of the circular-deps tool is purely
based on the order of source files passed to the tool, and on the
amount of imports inside source files.

This is actually resulting in deterministic output as running
the tool multiple times without any changes to source files,
results in the same output.

Though it seems like the tool is too strict and we can avoid
unnecessary golden changes if:

1. A source file that is part of a cycle is imported earlier (in terms
of how the analyzer visits them). This could result in the cycle path
starting with a different source file.

2. Source files which are not part of a cycle are imported earlier
(in terms of how the analyzer visits them). This could result in moved
items in the golden if re-approved (even though the cycles remain the same)

To fix this, we normalize the cycle path array that serves as
serializable data structure for the text-based goldens. Since
the paths represents a cycle, the path can be shifted in a
deterministic way so that cycles don't change unnecessarily
in the golden, and to simplify comparison of cycles.

Additionally, we sort the cycles in a deterministic way so
that the golden doesn't change unnecessarily (as explained above).

PR Close #36505
2020-04-08 12:12:58 -07:00
..
public-api fix(router): allow UrlMatcher to return null (#36402) 2020-04-03 11:16:23 -07:00
BUILD.bazel ci: move public-api goldens to goldens directory (#35768) 2020-03-10 20:58:39 -04:00
README.md ci: set up golden file for typescript circular dependencies (#35647) 2020-03-17 12:27:07 -07:00
packages-circular-deps.json build: ts-circular-deps tool should normalize golden (#36505) 2020-04-08 12:12:58 -07:00

README.md

public-api/

This directory contains all of the public api goldens for our npm packages we publish to NPM. These are tested on all PRs and commits as part of the our bazel tests.

To check or update the public api goldens, run one of the following commands:

yarn public-api:check
yarn public-api:update

packages-circular-deps.json

This golden file contains a list of all circular dependencies in the project. As part of the lint CI job we compare the current circular dependencies against this golden to ensure that we don't add more cycles. If cycles have been fixed, this file is also updated so that we can slowly burn down the number of cycles in the project.

To check or update the golden, run the following commands:

yarn ts-circular-deps:check
yarn ts-circular-deps:approve