refactor(compiler-cli): move typecheck test utils into its own package (#42984)

This commit moves the test utils used in the typechecking tests into its
own package. This makes them available to be used in the tests of a
different package.

Refs #42966

PR Close #42984
This commit is contained in:
Daniel Trevino 2021-07-27 16:12:25 +00:00 committed by Andrew Kushnir
parent be8a8e17a8
commit 29e2bc7d91
12 changed files with 125 additions and 96 deletions

View File

@ -26,6 +26,7 @@ ts_library(
"//packages/compiler-cli/src/ngtsc/typecheck",
"//packages/compiler-cli/src/ngtsc/typecheck/api",
"//packages/compiler-cli/src/ngtsc/typecheck/diagnostics",
"//packages/compiler-cli/src/ngtsc/typecheck/testing",
"//packages/compiler-cli/src/ngtsc/util",
"@npm//typescript",
],

View File

@ -12,7 +12,7 @@ import {absoluteFrom, getSourceFileOrError} from '../../file_system';
import {runInEachFileSystem, TestFile} from '../../file_system/testing';
import {OptimizeFor, TypeCheckingConfig} from '../api';
import {ngForDeclaration, ngForDts, setup, TestDeclaration} from './test_utils';
import {ngForDeclaration, ngForDts, setup, TestDeclaration} from '../testing';
runInEachFileSystem(() => {
describe('template diagnostics', () => {

View File

@ -15,7 +15,7 @@ import {sfExtensionData, ShimReferenceTagger} from '../../shims';
import {expectCompleteReuse, makeProgram} from '../../testing';
import {OptimizeFor} from '../api';
import {setup} from './test_utils';
import {setup} from '../testing';
runInEachFileSystem(() => {
describe('template type-checking program', () => {

View File

@ -7,7 +7,7 @@
*/
import {initMockFileSystem} from '../../file_system/testing';
import {tcb, TestDeclaration} from './test_utils';
import {tcb, TestDeclaration} from '../testing';
describe('type check blocks diagnostics', () => {
beforeEach(() => initMockFileSystem('Native'));

View File

@ -9,7 +9,7 @@
import {initMockFileSystem} from '../../file_system/testing';
import {TypeCheckingConfig} from '../api';
import {ALL_ENABLED_CONFIG, tcb, TestDeclaration, TestDirective} from './test_utils';
import {ALL_ENABLED_CONFIG, tcb, TestDeclaration, TestDirective} from '../testing';
describe('type check blocks', () => {

View File

@ -14,7 +14,7 @@ import {runInEachFileSystem} from '../../file_system/testing';
import {getTokenAtPosition} from '../../util/src/typescript';
import {CompletionKind, GlobalCompletion, TemplateTypeChecker, TypeCheckingConfig} from '../api';
import {getClass, setup, TypeCheckingTarget} from './test_utils';
import {getClass, setup, TypeCheckingTarget} from '../testing';
runInEachFileSystem(() => {
describe('TemplateTypeChecker.getGlobalCompletions()', () => {

View File

@ -15,7 +15,7 @@ import {runInEachFileSystem} from '../../file_system/testing';
import {ClassDeclaration} from '../../reflection';
import {DirectiveSymbol, DomBindingSymbol, ElementSymbol, ExpressionSymbol, InputBindingSymbol, OutputBindingSymbol, PipeSymbol, ReferenceSymbol, Symbol, SymbolKind, TemplateSymbol, TemplateTypeChecker, TypeCheckingConfig, VariableSymbol} from '../api';
import {getClass, ngForDeclaration, ngForTypeCheckTarget, setup as baseTestSetup, TypeCheckingTarget} from './test_utils';
import {getClass, ngForDeclaration, ngForTypeCheckTarget, setup as baseTestSetup, TypeCheckingTarget} from '../testing';
runInEachFileSystem(() => {
describe('TemplateTypeChecker.getSymbolOfNode', () => {

View File

@ -11,7 +11,7 @@ import {absoluteFrom, absoluteFromSourceFile, getSourceFileOrError} from '../../
import {runInEachFileSystem} from '../../file_system/testing';
import {OptimizeFor} from '../api';
import {getClass, setup, TestDeclaration} from './test_utils';
import {getClass, setup, TestDeclaration} from '../testing';
runInEachFileSystem(() => {
describe('TemplateTypeChecker', () => {

View File

@ -19,7 +19,7 @@ import {InliningMode, PendingFileTypeCheckingData, TypeCheckContextImpl, TypeChe
import {TemplateSourceManager} from '../src/source';
import {TypeCheckFile} from '../src/type_check_file';
import {ALL_ENABLED_CONFIG} from './test_utils';
import {ALL_ENABLED_CONFIG} from '../testing';
runInEachFileSystem(() => {
describe('ngtsc typechecking', () => {

View File

@ -13,7 +13,7 @@ import {isNamedClassDeclaration, TypeScriptReflectionHost} from '../../reflectio
import {getDeclaration, makeProgram} from '../../testing';
import {TypeParameterEmitter} from '../src/type_parameter_emitter';
import {angularCoreDts} from './test_utils';
import {angularCoreDts} from '../testing';
runInEachFileSystem(() => {

View File

@ -0,0 +1,28 @@
load("//tools:defaults.bzl", "ts_library")
ts_library(
name = "testing",
testonly = True,
srcs = glob([
"**/*.ts",
]),
visibility = ["//packages/compiler-cli/src/ngtsc:__subpackages__"],
deps = [
"//packages/compiler",
"//packages/compiler-cli/src/ngtsc/file_system",
"//packages/compiler-cli/src/ngtsc/file_system/testing",
"//packages/compiler-cli/src/ngtsc/imports",
"//packages/compiler-cli/src/ngtsc/incremental",
"//packages/compiler-cli/src/ngtsc/metadata",
"//packages/compiler-cli/src/ngtsc/perf",
"//packages/compiler-cli/src/ngtsc/program_driver",
"//packages/compiler-cli/src/ngtsc/reflection",
"//packages/compiler-cli/src/ngtsc/scope",
"//packages/compiler-cli/src/ngtsc/testing",
"//packages/compiler-cli/src/ngtsc/typecheck",
"//packages/compiler-cli/src/ngtsc/typecheck/api",
"//packages/compiler-cli/src/ngtsc/typecheck/diagnostics",
"//packages/compiler-cli/src/ngtsc/util",
"@npm//typescript",
],
)