mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
As part of the Bazel toolchain migration we noticed that implicit types generated by the TypeScript compiler sometimes end up referencing types from other packages (i.e. cross-package imports). These imports currently work just because the Bazel `ts_library` and `ng_module` rules automatically inserted a `<amd-module name="@angular/x" />` into `.d.ts` of packages. This helped TS figure out how to import a given file. Notably this is custom logic that is not occuring in vanilla TS or Angular compilations—so we will drop this magic as part of the toolchain cleanup! To improve code quality and keep the existing behavior working, we are doing the following: - adding a lint rule that reduces the risk of such imports breaking. The failure scenario without the rule is that API goldens show unexpected diffs, and types might be duplicated in a different package! - keeping the `<amd-module` headers, but we manually insert them into the package entry-points. This should ensure we don't regress anywhere; while we also improved general safety around this above. Long-term, isolated declarations or a lint rule from eslint-typescript can make this even more robust. PR Close #61312 |
||
|---|---|---|
| .. | ||
| src | ||
| BUILD.bazel | ||
| e2e_test.bzl | ||
| README.md | ||
| tsconfig-build.json | ||
| tsconfig-e2e.json | ||
| tsconfig.json | ||
How to run the benchmarks locally
Run in the browser
yarn bazel run modules/benchmarks/src/tree/{name}:devserver
# e.g. "ng2" tree benchmark:
yarn bazel run modules/benchmarks/src/tree/ng2:devserver
Run e2e tests
# Run e2e tests of individual applications:
yarn bazel test modules/benchmarks/src/tree/ng2/...
# Run all e2e tests:
yarn bazel test modules/benchmarks/...
Use of *_aot.ts files
The *_aot.ts files are used as entry-points within Google to run the benchmark
tests. These are still built as part of the corresponding ng_module rule.
Specifying benchmark options
There are options that can be specified in order to control how a given benchmark target runs. The following options can be set through test environment variables:
PERF_SAMPLE_SIZE: Benchpress performs measurements untilscriptTimepredictively no longer decreases. It does this by using a simple linear regression with the amount of samples specified. Defaults to20samples.PERF_FORCE_GC: If set totrue,@angular/benchpresswill run run the garbage collector before and after performing measurements. Benchpress will measure and report the garbage collection time.PERF_DRYRUN: If set totrue, no results are printed and stored in ajsonfile. Also benchpress only performs a single measurement (unlike with the simple linear regression).
Here is an example command that sets the PERF_DRYRUN option:
yarn bazel test modules/benchmarks/src/tree/baseline:perf --test_env=PERF_DRYRUN=true