angular-docs-cn/packages/language-service/ivy
Alex Rickabaugh b6893d23c5 test(language-service): introduce new virtual testing environment (#39594)
This commit adds new language service testing infrastructure which allows
for in-memory testing. It solves a number of issues with the previous
testing infrastructure that relied on a single integration project across
all of the tests, and also provides for much faster builds by using
the compiler-cli's mock versions of @angular/core and @angular/common.

A new `LanguageServiceTestEnvironment` class (conceptually mirroring the
compiler-cli `NgtscTestEnvironment`) controls setup and execution of tests.
The `FileSystem` abstraction is used to drive a `ts.server.ServerHost`,
which backs the language service infrastructure.

Since many language service tests revolve around the template, the API is
currently optimized to spin up a "skeleton" project and then override its
template for each test.

The existing Quick Info tests (quick_info_spec.ts) were ported to the new
infrastructure for validation. The tests were cleaned up a bit to remove
unnecessary initializations as well as correct legitimate template errors
which did not affect the test outcome, but caused additional validation of
test correctness to fail. They still utilize a shared project with all
fields required for each individual unit test, which is an anti-pattern, but
new tests can now easily be written independently without relying on the
shared project, which was extremely difficult previously. Future cleanup
work might refactor these tests to be more independent.

PR Close #39594
2020-11-17 11:59:56 -08:00
..
test test(language-service): introduce new virtual testing environment (#39594) 2020-11-17 11:59:56 -08:00
BUILD.bazel refactor(language-service): Use compiler APIs in Ivy to get definitions for external resources (#39476) 2020-11-06 09:17:33 -08:00
compiler_factory.ts test(language-service): introduce new virtual testing environment (#39594) 2020-11-17 11:59:56 -08:00
definitions.ts refactor(language-service): Use compiler APIs in Ivy to get definitions for external resources (#39476) 2020-11-06 09:17:33 -08:00
display_parts.ts refactor(language-service): introduce DisplayParts abstraction for Ivy (#39505) 2020-11-02 10:29:50 -08:00
language_service.ts test(language-service): introduce new virtual testing environment (#39594) 2020-11-17 11:59:56 -08:00
language_service_adapter.ts refactor(language-service): Use compiler APIs in Ivy to get definitions for external resources (#39476) 2020-11-06 09:17:33 -08:00
quick_info.ts refactor(language-service): refactor `HybridVisitor` and expand its capabilities (#39505) 2020-11-02 10:29:50 -08:00
template_target.ts refactor(language-service): refactor `HybridVisitor` and expand its capabilities (#39505) 2020-11-02 10:29:50 -08:00
ts_plugin.ts feat(language-service): Add getTypeDefinitionAtPosition (go to type definition) (#39145) 2020-10-09 10:57:37 -07:00
ts_utils.ts refactor(language-service): Use compiler APIs in Ivy to get definitions for external resources (#39476) 2020-11-06 09:17:33 -08:00
utils.ts refactor(language-service): Use compiler APIs in Ivy to get definitions for external resources (#39476) 2020-11-06 09:17:33 -08:00