angular/packages
Kristiyan Kostadinov 08caeadddb fix(core): avoid duplicating comments in TestBed teardown migration (#43776)
Currently the TestBed teardown migration is set up in a similar way to all other migrations where we take a `CallExpression`, add a parameter to it, print it, and replace the existing call. The problem is that doing so while preserving the `expression` of the original `CallExpression` can cause comments to be duplicated. This can happen quite frequently, because by default the CLI generates comments before `initTestModule` calls.

To work around it, these changes make the migration more precise by inserting a new parameter or replacing and existing one using string manipulation.

This requires a bit more code, but it's more reliable than the following alternatives:
1. Using `getFullStart` and `getFullWidth` to replace the node. This would work with our current setup, but the problem is that `getFullStart` also includes whitespace and newlines before the leading comment. This can cause us to mess up the user's formatting and figuring out which whitespace to keep and which one to remove is tricky.
2. Recreating the `CallExpression.expression` when constructing the new node. This would also work since it'll drop any existing comments, but the problem is that `CallExpression.expression` can be a wide variety of nodes which we would have to account for. We can't use `getMutableClone`, because it preserves the comments.

Fixes #43739.

PR Close #43776
2021-10-11 17:18:55 +00:00
..
animations feat(core): update node version support range to support v16 (#43740) 2021-10-06 10:55:44 -07:00
bazel build: update dependency @microsoft/api-extractor to v7.18.15 (#43771) 2021-10-08 20:42:42 +00:00
benchpress feat(core): support TypeScript 4.4 (#43281) 2021-09-23 14:49:19 -07:00
common refactor(compiler-cli): update peerDependencies to require rxjs ^7.4.0 (#43748) 2021-10-06 15:57:59 -07:00
compiler feat(core): update node version support range to support v16 (#43740) 2021-10-06 10:55:44 -07:00
compiler-cli feat(core): update node version support range to support v16 (#43740) 2021-10-06 10:55:44 -07:00
core fix(core): avoid duplicating comments in TestBed teardown migration (#43776) 2021-10-11 17:18:55 +00:00
docs docs: remove/update broken links in resources appearing on aio (#42232) 2021-05-26 14:21:12 -07:00
elements refactor(compiler-cli): update peerDependencies to require rxjs ^7.4.0 (#43748) 2021-10-06 15:57:59 -07:00
examples feat(forms): allow minLength/maxLength validator to be bound to null (#42565) 2021-07-21 22:35:59 +00:00
forms refactor(compiler-cli): update peerDependencies to require rxjs ^7.4.0 (#43748) 2021-10-06 15:57:59 -07:00
language-service feat(core): update node version support range to support v16 (#43740) 2021-10-06 10:55:44 -07:00
localize feat(core): update node version support range to support v16 (#43740) 2021-10-06 10:55:44 -07:00
misc/angular-in-memory-web-api refactor(compiler-cli): update peerDependencies to require rxjs ^7.4.0 (#43748) 2021-10-06 15:57:59 -07:00
platform-browser feat(core): update node version support range to support v16 (#43740) 2021-10-06 10:55:44 -07:00
platform-browser-dynamic feat(core): update node version support range to support v16 (#43740) 2021-10-06 10:55:44 -07:00
platform-server docs: deprecate ViewEngine-based renderModuleFactory (#43757) 2021-10-07 16:47:54 -07:00
private/testing docs: convert the last my-app components to app-root (#42256) 2021-05-25 22:13:36 +00:00
router refactor(compiler-cli): update peerDependencies to require rxjs ^7.4.0 (#43748) 2021-10-06 15:57:59 -07:00
service-worker feat(core): update node version support range to support v16 (#43740) 2021-10-06 10:55:44 -07:00
upgrade feat(core): update node version support range to support v16 (#43740) 2021-10-06 10:55:44 -07:00
zone.js build: update dependency google-closure-compiler to v20211006 (#43754) 2021-10-07 20:55:49 +00:00
BUILD.bazel build: Auto-gen tsec tsconfig files (#43440) 2021-09-17 17:17:34 +00:00
circular-deps-test.conf.js fix(platform-webworker): remove platform-webworker and platform-webworker-dynamic (#38846) 2020-09-30 09:13:59 -04:00
empty.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
goog.d.ts refactor(core): replace references to goog.LOCALE with goog.getLocale() (#43089) 2021-08-10 10:35:26 -07:00
license-banner.txt docs: update year (#40925) 2021-02-22 12:37:40 -08:00
README.md docs: add doc reference to npm package readme (#33911) 2019-11-20 14:46:23 -08:00
system.d.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
tsconfig-build.json build: enable esModuleInterop in TypeScript compilations (#43431) 2021-10-01 18:28:45 +00:00
tsconfig-legacy-saucelabs.json build: update tsconfigs to use ES2020 as target and module (#43431) 2021-10-01 18:28:42 +00:00
tsconfig-test.json refactor: fix typescript strict flag failures in all tests (#30993) 2019-07-18 14:21:26 -07:00
tsconfig-tsec-base.json build: update tsconfigs to use ES2020 as target and module (#43431) 2021-10-01 18:28:42 +00:00
tsconfig.json build: enable esModuleInterop in TypeScript compilations (#43431) 2021-10-01 18:28:45 +00:00
tsec-exemption.json build: Enable tsec checks for critical packages. (#43108) 2021-09-13 14:45:57 -07:00
types.d.ts build: replace @types/trusted-types dep with minimal type defs (#39211) 2020-10-15 09:08:00 -07:00

Angular

The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.

Usage information and reference details can be found in Angular documentation.

License: MIT