test(language-service): move existing tests to legacy directory (#39594)
In preparation for in-memory testing infrastructure, the existing Ivy language service tests are moved to a `legacy` directory. These existing tests rely on a single integration project in `test/project/app`, which presents a number of challenges: * adding extra fields/properties to the integration project for one test can cause others to fail/flake. * it's especially difficult to test any cases that require introducing intentional errors, as those tend to break other tests. * tests load files from disk, which is slower. * tests rely on the real built versions of @angular/core and @angular/common, which makes them both slow to build and require rebuilds on every compiler change. * tests share a single tsconfig.json, making it extremely difficult to test how the language service handles different configuration scenarios (e.g. different type-checking flags). PR Close #39594
This commit is contained in:
parent
c243ff3b6b
commit
a7155bc2fa
|
@ -1,7 +1,7 @@
|
|||
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "test_lib",
|
||||
name = "legacy_lib",
|
||||
testonly = True,
|
||||
srcs = glob(["*.ts"]),
|
||||
deps = [
|
||||
|
@ -12,7 +12,7 @@ ts_library(
|
|||
)
|
||||
|
||||
jasmine_node_test(
|
||||
name = "test",
|
||||
name = "legacy",
|
||||
data = [
|
||||
# Note that we used to depend on the npm_package of common, core, and
|
||||
# forms, but this is no longer the case. We did it for View Engine
|
||||
|
@ -28,6 +28,6 @@ jasmine_node_test(
|
|||
"ivy-only",
|
||||
],
|
||||
deps = [
|
||||
":test_lib",
|
||||
":legacy_lib",
|
||||
],
|
||||
)
|
|
@ -6,7 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {LanguageService} from '../language_service';
|
||||
import {LanguageService} from '../../language_service';
|
||||
|
||||
import {APP_COMPONENT, MockService, setup} from './mock_host';
|
||||
import {humanizeDefinitionInfo} from './test_utils';
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import * as ts from 'typescript/lib/tsserverlibrary';
|
||||
|
||||
import {LanguageService} from '../language_service';
|
||||
import {LanguageService} from '../../language_service';
|
||||
|
||||
import {APP_COMPONENT, MockService, setup, TEST_TEMPLATE} from './mock_host';
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import * as ts from 'typescript/lib/tsserverlibrary';
|
||||
|
||||
import {LanguageServiceAdapter} from '../language_service_adapter';
|
||||
import {LanguageServiceAdapter} from '../../language_service_adapter';
|
||||
|
||||
import {MockService, setup, TEST_TEMPLATE} from './mock_host';
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import * as ts from 'typescript/lib/tsserverlibrary';
|
||||
|
||||
import {LanguageService, parseNgCompilerOptions} from '../language_service';
|
||||
import {LanguageService, parseNgCompilerOptions} from '../../language_service';
|
||||
|
||||
import {MockService, setup, TEST_TEMPLATE} from './mock_host';
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
import {join} from 'path';
|
||||
import * as ts from 'typescript/lib/tsserverlibrary';
|
||||
|
||||
import {isTypeScriptFile} from '../utils';
|
||||
import {isTypeScriptFile} from '../../utils';
|
||||
|
||||
const logger: ts.server.Logger = {
|
||||
close(): void{},
|
||||
|
@ -147,7 +147,7 @@ export class MockService {
|
|||
return this.overwriteScriptInfo(scriptInfo, text);
|
||||
}
|
||||
|
||||
reset() {
|
||||
reset(): void {
|
||||
if (this.overwritten.size === 0) {
|
||||
return;
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import * as ts from 'typescript/lib/tsserverlibrary';
|
||||
|
||||
import {LanguageService} from '../language_service';
|
||||
import {LanguageService} from '../../language_service';
|
||||
|
||||
import {APP_COMPONENT, MockService, setup, TEST_TEMPLATE} from './mock_host';
|
||||
|
|
@ -10,8 +10,8 @@ import {ParseError, parseTemplate} from '@angular/compiler';
|
|||
import * as e from '@angular/compiler/src/expression_parser/ast'; // e for expression AST
|
||||
import * as t from '@angular/compiler/src/render3/r3_ast'; // t for template AST
|
||||
|
||||
import {getTargetAtPosition} from '../template_target';
|
||||
import {isExpressionNode, isTemplateNode} from '../utils';
|
||||
import {getTargetAtPosition} from '../../template_target';
|
||||
import {isExpressionNode, isTemplateNode} from '../../utils';
|
||||
|
||||
interface ParseResult {
|
||||
nodes: t.Node[];
|
|
@ -6,7 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {LanguageService} from '../language_service';
|
||||
import {LanguageService} from '../../language_service';
|
||||
|
||||
import {APP_COMPONENT, MockService, setup} from './mock_host';
|
||||
import {HumanizedDefinitionInfo, humanizeDefinitionInfo} from './test_utils';
|
Loading…
Reference in New Issue