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:
parent
be8a8e17a8
commit
29e2bc7d91
@ -26,6 +26,7 @@ ts_library(
|
|||||||
"//packages/compiler-cli/src/ngtsc/typecheck",
|
"//packages/compiler-cli/src/ngtsc/typecheck",
|
||||||
"//packages/compiler-cli/src/ngtsc/typecheck/api",
|
"//packages/compiler-cli/src/ngtsc/typecheck/api",
|
||||||
"//packages/compiler-cli/src/ngtsc/typecheck/diagnostics",
|
"//packages/compiler-cli/src/ngtsc/typecheck/diagnostics",
|
||||||
|
"//packages/compiler-cli/src/ngtsc/typecheck/testing",
|
||||||
"//packages/compiler-cli/src/ngtsc/util",
|
"//packages/compiler-cli/src/ngtsc/util",
|
||||||
"@npm//typescript",
|
"@npm//typescript",
|
||||||
],
|
],
|
||||||
|
@ -12,7 +12,7 @@ import {absoluteFrom, getSourceFileOrError} from '../../file_system';
|
|||||||
import {runInEachFileSystem, TestFile} from '../../file_system/testing';
|
import {runInEachFileSystem, TestFile} from '../../file_system/testing';
|
||||||
import {OptimizeFor, TypeCheckingConfig} from '../api';
|
import {OptimizeFor, TypeCheckingConfig} from '../api';
|
||||||
|
|
||||||
import {ngForDeclaration, ngForDts, setup, TestDeclaration} from './test_utils';
|
import {ngForDeclaration, ngForDts, setup, TestDeclaration} from '../testing';
|
||||||
|
|
||||||
runInEachFileSystem(() => {
|
runInEachFileSystem(() => {
|
||||||
describe('template diagnostics', () => {
|
describe('template diagnostics', () => {
|
||||||
|
@ -15,7 +15,7 @@ import {sfExtensionData, ShimReferenceTagger} from '../../shims';
|
|||||||
import {expectCompleteReuse, makeProgram} from '../../testing';
|
import {expectCompleteReuse, makeProgram} from '../../testing';
|
||||||
import {OptimizeFor} from '../api';
|
import {OptimizeFor} from '../api';
|
||||||
|
|
||||||
import {setup} from './test_utils';
|
import {setup} from '../testing';
|
||||||
|
|
||||||
runInEachFileSystem(() => {
|
runInEachFileSystem(() => {
|
||||||
describe('template type-checking program', () => {
|
describe('template type-checking program', () => {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {initMockFileSystem} from '../../file_system/testing';
|
import {initMockFileSystem} from '../../file_system/testing';
|
||||||
import {tcb, TestDeclaration} from './test_utils';
|
import {tcb, TestDeclaration} from '../testing';
|
||||||
|
|
||||||
describe('type check blocks diagnostics', () => {
|
describe('type check blocks diagnostics', () => {
|
||||||
beforeEach(() => initMockFileSystem('Native'));
|
beforeEach(() => initMockFileSystem('Native'));
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
import {initMockFileSystem} from '../../file_system/testing';
|
import {initMockFileSystem} from '../../file_system/testing';
|
||||||
import {TypeCheckingConfig} from '../api';
|
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', () => {
|
describe('type check blocks', () => {
|
||||||
|
@ -14,7 +14,7 @@ import {runInEachFileSystem} from '../../file_system/testing';
|
|||||||
import {getTokenAtPosition} from '../../util/src/typescript';
|
import {getTokenAtPosition} from '../../util/src/typescript';
|
||||||
import {CompletionKind, GlobalCompletion, TemplateTypeChecker, TypeCheckingConfig} from '../api';
|
import {CompletionKind, GlobalCompletion, TemplateTypeChecker, TypeCheckingConfig} from '../api';
|
||||||
|
|
||||||
import {getClass, setup, TypeCheckingTarget} from './test_utils';
|
import {getClass, setup, TypeCheckingTarget} from '../testing';
|
||||||
|
|
||||||
runInEachFileSystem(() => {
|
runInEachFileSystem(() => {
|
||||||
describe('TemplateTypeChecker.getGlobalCompletions()', () => {
|
describe('TemplateTypeChecker.getGlobalCompletions()', () => {
|
||||||
|
@ -15,7 +15,7 @@ import {runInEachFileSystem} from '../../file_system/testing';
|
|||||||
import {ClassDeclaration} from '../../reflection';
|
import {ClassDeclaration} from '../../reflection';
|
||||||
import {DirectiveSymbol, DomBindingSymbol, ElementSymbol, ExpressionSymbol, InputBindingSymbol, OutputBindingSymbol, PipeSymbol, ReferenceSymbol, Symbol, SymbolKind, TemplateSymbol, TemplateTypeChecker, TypeCheckingConfig, VariableSymbol} from '../api';
|
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(() => {
|
runInEachFileSystem(() => {
|
||||||
describe('TemplateTypeChecker.getSymbolOfNode', () => {
|
describe('TemplateTypeChecker.getSymbolOfNode', () => {
|
||||||
|
@ -11,7 +11,7 @@ import {absoluteFrom, absoluteFromSourceFile, getSourceFileOrError} from '../../
|
|||||||
import {runInEachFileSystem} from '../../file_system/testing';
|
import {runInEachFileSystem} from '../../file_system/testing';
|
||||||
import {OptimizeFor} from '../api';
|
import {OptimizeFor} from '../api';
|
||||||
|
|
||||||
import {getClass, setup, TestDeclaration} from './test_utils';
|
import {getClass, setup, TestDeclaration} from '../testing';
|
||||||
|
|
||||||
runInEachFileSystem(() => {
|
runInEachFileSystem(() => {
|
||||||
describe('TemplateTypeChecker', () => {
|
describe('TemplateTypeChecker', () => {
|
||||||
|
@ -19,7 +19,7 @@ import {InliningMode, PendingFileTypeCheckingData, TypeCheckContextImpl, TypeChe
|
|||||||
import {TemplateSourceManager} from '../src/source';
|
import {TemplateSourceManager} from '../src/source';
|
||||||
import {TypeCheckFile} from '../src/type_check_file';
|
import {TypeCheckFile} from '../src/type_check_file';
|
||||||
|
|
||||||
import {ALL_ENABLED_CONFIG} from './test_utils';
|
import {ALL_ENABLED_CONFIG} from '../testing';
|
||||||
|
|
||||||
runInEachFileSystem(() => {
|
runInEachFileSystem(() => {
|
||||||
describe('ngtsc typechecking', () => {
|
describe('ngtsc typechecking', () => {
|
||||||
|
@ -13,7 +13,7 @@ import {isNamedClassDeclaration, TypeScriptReflectionHost} from '../../reflectio
|
|||||||
import {getDeclaration, makeProgram} from '../../testing';
|
import {getDeclaration, makeProgram} from '../../testing';
|
||||||
import {TypeParameterEmitter} from '../src/type_parameter_emitter';
|
import {TypeParameterEmitter} from '../src/type_parameter_emitter';
|
||||||
|
|
||||||
import {angularCoreDts} from './test_utils';
|
import {angularCoreDts} from '../testing';
|
||||||
|
|
||||||
|
|
||||||
runInEachFileSystem(() => {
|
runInEachFileSystem(() => {
|
||||||
|
@ -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",
|
||||||
|
],
|
||||||
|
)
|
Loading…
x
Reference in New Issue
Block a user