angular-docs-cn/packages/core/test
Kristiyan Kostadinov 0f23f7343e fix(core): error in TestBed if module is reset mid-compilation in ViewEngine (#42669)
When `TestBed.compileComponents` is called under ViewEngine, we kick off a compilation and return a promise that resolves once the compilation is done. In most cases the consumer doesn't _have_ to await the returned promise, unless their components have external resources.

The problem is that the test could be over by the time the promise has resolved, in which case we still cache the factory of the test module. This becomes a problem if another compilation is triggered right afterwards, because it'll see that we still have a `_moduleFactory` and it won't recreate the factory.

These changes resolve the issue by saving a reference to the module type that is being compiled and checking against it when the promise resolves.

Note that while this problem was discovered while trying to roll out the new test module teardown behavior in the Components repo (https://github.com/angular/components/pull/23070), it has been there for a long time. The new test behavior made it more apparent.

PR Close #42669
2021-06-30 14:32:23 -07:00
..
acceptance feat(compiler): support number separators in templates (#42672) 2021-06-30 10:36:15 -07:00
animation fix(animations): ensure consistent transition namespace ordering (#19854) 2021-04-30 14:15:47 -07:00
bundling fix(platform-browser): prevent memory leak of style nodes if shadow DOM encapsulation is used (#42005) 2021-05-10 16:12:19 -04:00
change_detection test: clean up internal testing utilities (#42177) 2021-05-26 20:07:25 +00:00
debug fix(core): error if DebugRenderer2.destroyNode is called twice in a row (#41565) 2021-04-12 10:30:11 -07:00
di ci: add lint error for files with missing trailing new-line (#42478) 2021-06-04 13:31:03 -07:00
dom test: clean up internal testing utilities (#42177) 2021-05-26 20:07:25 +00:00
i18n build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
linker test: clean up internal testing utilities (#42177) 2021-05-26 20:07:25 +00:00
metadata build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
reflection fix(core): detect synthesized constructors that have been downleveled using TS 4.2 (#41305) 2021-03-23 11:23:04 -07:00
render3 ci: add lint error for files with missing trailing new-line (#42478) 2021-06-04 13:31:03 -07:00
sanitization test: clean up internal testing utilities (#42177) 2021-05-26 20:07:25 +00:00
strict_types refactor(core): rename `...WithMeta` types to `...Declaration` and alias to `unknown` (#41119) 2021-03-22 08:57:18 -07:00
testability test: clean up internal testing utilities (#42177) 2021-05-26 20:07:25 +00:00
util fix(core): fix possible XSS attack in development through SSR (#40525) 2021-01-26 09:32:27 -08:00
view refactor(core): rename `ɵɵInjectableDef` interface to `ɵɵInjectableDeclaration` (#41316) 2021-04-07 13:57:12 -07:00
zone test: clean up internal testing utilities (#42177) 2021-05-26 20:07:25 +00:00
BUILD.bazel fix(core): detect synthesized constructors that have been downleveled using TS 4.2 (#41305) 2021-03-23 11:23:04 -07:00
application_init_spec.ts test(core): refactor ApplicationInitStatus tests to avoid TestBed side-effects (#33222) 2021-02-22 08:41:49 -08:00
application_module_spec.ts test: clean up internal testing utilities (#42177) 2021-05-26 20:07:25 +00:00
application_ref_integration_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
application_ref_spec.ts perf(common): remove unused methods from DomAdapter (#41102) 2021-03-10 11:48:24 -08:00
component_fixture_spec.ts feat(core): update reference and doc to change `async` to `waitAsync`. (#37583) 2020-08-03 12:54:13 -07:00
dev_mode_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
directive_lifecycle_integration_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
error_handler_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
event_emitter_spec.ts test: clean up internal testing utilities (#42177) 2021-05-26 20:07:25 +00:00
fake_async_spec.ts test: clean up internal testing utilities (#42177) 2021-05-26 20:07:25 +00:00
forward_ref_integration_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
test_bed_spec.ts fix(core): error in TestBed if module is reset mid-compilation in ViewEngine (#42669) 2021-06-30 14:32:23 -07:00
util_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00