feat(compiler-cli): reflect static methods added to classes in metadata (#21926)
PR Close #21926
This commit is contained in:

committed by
Alex Rickabaugh

parent
1aa2947f70
commit
eb8ddd2983
@ -8,8 +8,9 @@
|
||||
|
||||
import * as ts from 'typescript';
|
||||
|
||||
import {ModuleMetadata} from '../../src/metadata/index';
|
||||
import {LowerMetadataCache, LoweringRequest, RequestLocationMap, getExpressionLoweringTransformFactory} from '../../src/transformers/lower_expressions';
|
||||
import {MetadataCollector, ModuleMetadata} from '../../src/metadata/index';
|
||||
import {LowerMetadataTransform, LoweringRequest, RequestLocationMap, getExpressionLoweringTransformFactory} from '../../src/transformers/lower_expressions';
|
||||
import {MetadataCache} from '../../src/transformers/metadata_cache';
|
||||
import {Directory, MockAotContext, MockCompilerHost} from '../mocks';
|
||||
|
||||
describe('Expression lowering', () => {
|
||||
@ -110,7 +111,8 @@ describe('Expression lowering', () => {
|
||||
});
|
||||
|
||||
it('should throw a validation exception for invalid files', () => {
|
||||
const cache = new LowerMetadataCache({}, /* strict */ true);
|
||||
const cache = new MetadataCache(
|
||||
new MetadataCollector({}), /* strict */ true, [new LowerMetadataTransform()]);
|
||||
const sourceFile = ts.createSourceFile(
|
||||
'foo.ts', `
|
||||
import {Injectable} from '@angular/core';
|
||||
@ -126,7 +128,8 @@ describe('Expression lowering', () => {
|
||||
});
|
||||
|
||||
it('should not report validation errors on a .d.ts file', () => {
|
||||
const cache = new LowerMetadataCache({}, /* strict */ true);
|
||||
const cache = new MetadataCache(
|
||||
new MetadataCollector({}), /* strict */ true, [new LowerMetadataTransform()]);
|
||||
const dtsFile = ts.createSourceFile(
|
||||
'foo.d.ts', `
|
||||
import {Injectable} from '@angular/core';
|
||||
@ -241,11 +244,12 @@ function normalizeResult(result: string): string {
|
||||
|
||||
function collect(annotatedSource: string) {
|
||||
const {annotations, unannotatedSource} = getAnnotations(annotatedSource);
|
||||
const cache = new LowerMetadataCache({});
|
||||
const transformer = new LowerMetadataTransform();
|
||||
const cache = new MetadataCache(new MetadataCollector({}), false, [transformer]);
|
||||
const sourceFile = ts.createSourceFile(
|
||||
'someName.ts', unannotatedSource, ts.ScriptTarget.Latest, /* setParentNodes */ true);
|
||||
return {
|
||||
metadata: cache.getMetadata(sourceFile),
|
||||
requests: cache.getRequests(sourceFile), annotations
|
||||
requests: transformer.getRequests(sourceFile), annotations
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user