test(compiler-cli): ensure indexer tests are not brittle to case-sensitivity (#36859)
These tests were matching file-paths against what is retrieved from the TS compiler. But the TS compiler paths have been canonicalised, so the tests were brittle on case-insensitive file-systems. PR Close #36859
This commit is contained in:
parent
a10c126692
commit
8ce38cac0d
@ -23,7 +23,7 @@ runInEachFileSystem(() => {
|
||||
boundTemplate,
|
||||
templateMeta: {
|
||||
isInline: false,
|
||||
file: new ParseSourceFile('<div></div>', util.getTestFilePath()),
|
||||
file: new ParseSourceFile('<div></div>', declaration.getSourceFile().fileName),
|
||||
},
|
||||
});
|
||||
|
||||
@ -34,7 +34,7 @@ runInEachFileSystem(() => {
|
||||
boundTemplate,
|
||||
templateMeta: {
|
||||
isInline: false,
|
||||
file: new ParseSourceFile('<div></div>', util.getTestFilePath()),
|
||||
file: new ParseSourceFile('<div></div>', declaration.getSourceFile().fileName),
|
||||
},
|
||||
},
|
||||
]));
|
||||
|
@ -25,7 +25,7 @@ function populateContext(
|
||||
boundTemplate,
|
||||
templateMeta: {
|
||||
isInline,
|
||||
file: new ParseSourceFile(template, util.getTestFilePath()),
|
||||
file: new ParseSourceFile(template, component.getSourceFile().fileName),
|
||||
},
|
||||
});
|
||||
}
|
||||
@ -45,12 +45,12 @@ runInEachFileSystem(() => {
|
||||
expect(info).toEqual({
|
||||
name: 'C',
|
||||
selector: 'c-selector',
|
||||
file: new ParseSourceFile('class C {}', util.getTestFilePath()),
|
||||
file: new ParseSourceFile('class C {}', decl.getSourceFile().fileName),
|
||||
template: {
|
||||
identifiers: getTemplateIdentifiers(util.getBoundTemplate('<div>{{foo}}</div>')),
|
||||
usedComponents: new Set(),
|
||||
isInline: false,
|
||||
file: new ParseSourceFile('<div>{{foo}}</div>', util.getTestFilePath()),
|
||||
file: new ParseSourceFile('<div>{{foo}}</div>', decl.getSourceFile().fileName),
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -69,7 +69,7 @@ runInEachFileSystem(() => {
|
||||
const info = analysis.get(decl);
|
||||
expect(info).toBeDefined();
|
||||
expect(info!.template.file)
|
||||
.toEqual(new ParseSourceFile('class C {}', util.getTestFilePath()));
|
||||
.toEqual(new ParseSourceFile('class C {}', decl.getSourceFile().fileName));
|
||||
});
|
||||
|
||||
it('should give external templates their own source file', () => {
|
||||
@ -84,7 +84,7 @@ runInEachFileSystem(() => {
|
||||
const info = analysis.get(decl);
|
||||
expect(info).toBeDefined();
|
||||
expect(info!.template.file)
|
||||
.toEqual(new ParseSourceFile('<div>{{foo}}</div>', util.getTestFilePath()));
|
||||
.toEqual(new ParseSourceFile('<div>{{foo}}</div>', decl.getSourceFile().fileName));
|
||||
});
|
||||
|
||||
it('should emit used components', () => {
|
||||
|
@ -16,7 +16,7 @@ import {getDeclaration, makeProgram} from '../../testing';
|
||||
import {ComponentMeta} from '../src/context';
|
||||
|
||||
/** Dummy file URL */
|
||||
export function getTestFilePath(): AbsoluteFsPath {
|
||||
function getTestFilePath(): AbsoluteFsPath {
|
||||
return absoluteFrom('/TEST_FILE.ts');
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user