test(ivy): fix broken testcase in Windows (#31860)
In #30181, several testcases were added that were failing in Windows. The reason was that a recent rebase missed a required change to interact with the compiler's virtualized filesystems. This commit introduces the required usage of the VFS layer to fix the testcase. PR Close #31860
This commit is contained in:
parent
859ebdd836
commit
397d0ba9a3
|
@ -11,7 +11,7 @@ import * as ts from 'typescript';
|
||||||
|
|
||||||
import {Diagnostic} from '../src/diagnostics';
|
import {Diagnostic} from '../src/diagnostics';
|
||||||
|
|
||||||
import {NGFOR_DECLARATION, TestDeclaration, ngForDts, typecheck} from './test_utils';
|
import {TestDeclaration, ngForDeclaration, ngForDts, typecheck} from './test_utils';
|
||||||
|
|
||||||
runInEachFileSystem(() => {
|
runInEachFileSystem(() => {
|
||||||
describe('template diagnostics', () => {
|
describe('template diagnostics', () => {
|
||||||
|
@ -46,7 +46,7 @@ runInEachFileSystem(() => {
|
||||||
|
|
||||||
render(input: string): string { return input; }
|
render(input: string): string { return input; }
|
||||||
}`,
|
}`,
|
||||||
[NGFOR_DECLARATION], [ngForDts()]);
|
[ngForDeclaration()], [ngForDts()]);
|
||||||
|
|
||||||
expect(messages).toEqual([
|
expect(messages).toEqual([
|
||||||
`synthetic.html(61, 64): Argument of type 'number' is not assignable to parameter of type 'string'.`,
|
`synthetic.html(61, 64): Argument of type 'number' is not assignable to parameter of type 'string'.`,
|
||||||
|
@ -61,7 +61,7 @@ runInEachFileSystem(() => {
|
||||||
|
|
||||||
render(input: string): string { return input; }
|
render(input: string): string { return input; }
|
||||||
}`,
|
}`,
|
||||||
[NGFOR_DECLARATION], [ngForDts()]);
|
[ngForDeclaration()], [ngForDts()]);
|
||||||
|
|
||||||
expect(messages).toEqual([]);
|
expect(messages).toEqual([]);
|
||||||
});
|
});
|
||||||
|
@ -127,7 +127,7 @@ runInEachFileSystem(() => {
|
||||||
name: string;
|
name: string;
|
||||||
}[];
|
}[];
|
||||||
}`,
|
}`,
|
||||||
[NGFOR_DECLARATION], [ngForDts()]);
|
[ngForDeclaration()], [ngForDts()]);
|
||||||
|
|
||||||
expect(messages).toEqual([
|
expect(messages).toEqual([
|
||||||
`synthetic.html(39, 52): Property 'namme' does not exist on type '{ name: string; }'. Did you mean 'name'?`,
|
`synthetic.html(39, 52): Property 'namme' does not exist on type '{ name: string; }'. Did you mean 'name'?`,
|
||||||
|
|
|
@ -77,14 +77,16 @@ export function angularCoreDts(): TestFile {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const NGFOR_DECLARATION: TestDeclaration = {
|
export function ngForDeclaration(): TestDeclaration {
|
||||||
type: 'directive',
|
return {
|
||||||
file: 'ngfor.d.ts',
|
type: 'directive',
|
||||||
selector: '[ngForOf]',
|
file: absoluteFrom('/ngfor.d.ts'),
|
||||||
name: 'NgForOf',
|
selector: '[ngForOf]',
|
||||||
inputs: {ngForOf: 'ngForOf'},
|
name: 'NgForOf',
|
||||||
hasNgTemplateContextGuard: true,
|
inputs: {ngForOf: 'ngForOf'},
|
||||||
};
|
hasNgTemplateContextGuard: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function ngForDts(): TestFile {
|
export function ngForDts(): TestFile {
|
||||||
return {
|
return {
|
||||||
|
@ -124,10 +126,10 @@ export const ALL_ENABLED_CONFIG: TypeCheckingConfig = {
|
||||||
// Remove 'ref' from TypeCheckableDirectiveMeta and add a 'selector' instead.
|
// Remove 'ref' from TypeCheckableDirectiveMeta and add a 'selector' instead.
|
||||||
export type TestDirective =
|
export type TestDirective =
|
||||||
Partial<Pick<TypeCheckableDirectiveMeta, Exclude<keyof TypeCheckableDirectiveMeta, 'ref'>>>&
|
Partial<Pick<TypeCheckableDirectiveMeta, Exclude<keyof TypeCheckableDirectiveMeta, 'ref'>>>&
|
||||||
{selector: string, name: string, file?: string, type: 'directive'};
|
{selector: string, name: string, file?: AbsoluteFsPath, type: 'directive'};
|
||||||
export type TestPipe = {
|
export type TestPipe = {
|
||||||
name: string,
|
name: string,
|
||||||
file?: string,
|
file?: AbsoluteFsPath,
|
||||||
pipeName: string,
|
pipeName: string,
|
||||||
type: 'pipe',
|
type: 'pipe',
|
||||||
};
|
};
|
||||||
|
@ -185,7 +187,7 @@ export function typecheck(
|
||||||
...additionalSources,
|
...additionalSources,
|
||||||
];
|
];
|
||||||
const {program, host, options} = makeProgram(files, {strictNullChecks: true}, undefined, false);
|
const {program, host, options} = makeProgram(files, {strictNullChecks: true}, undefined, false);
|
||||||
const sf = program.getSourceFile('main.ts') !;
|
const sf = program.getSourceFile(absoluteFrom('/main.ts')) !;
|
||||||
const checker = program.getTypeChecker();
|
const checker = program.getTypeChecker();
|
||||||
const logicalFs = new LogicalFileSystem(getRootDirs(host, options));
|
const logicalFs = new LogicalFileSystem(getRootDirs(host, options));
|
||||||
const emitter = new ReferenceEmitter([
|
const emitter = new ReferenceEmitter([
|
||||||
|
|
Loading…
Reference in New Issue