test(compiler-cli): ensure indexer tests are not brittle to case-sens… · angular/angular@3361f59 · GitHub
Skip to content

Commit 3361f59

Browse files
petebacondarwinalxhub
authored andcommitted
test(compiler-cli): ensure indexer tests are not brittle to case-sensitivity (#36968)
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 #36968
1 parent 7e9d5f5 commit 3361f59

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎packages/compiler-cli/src/ngtsc/indexer/test/context_spec.ts‎

Lines changed: 2 additions & 2 deletions

‎packages/compiler-cli/src/ngtsc/indexer/test/transform_spec.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function populateContext(
2525
boundTemplate,
2626
templateMeta: {
2727
isInline,
28-
file: new ParseSourceFile(template, util.getTestFilePath()),
28+
file: new ParseSourceFile(template, component.getSourceFile().fileName),
2929
},
3030
});
3131
}
@@ -45,12 +45,12 @@ runInEachFileSystem(() => {
4545
expect(info).toEqual({
4646
name: 'C',
4747
selector: 'c-selector',
48-
file: new ParseSourceFile('class C {}', util.getTestFilePath()),
48+
file: new ParseSourceFile('class C {}', decl.getSourceFile().fileName),
4949
template: {
5050
identifiers: getTemplateIdentifiers(util.getBoundTemplate('<div>{{foo}}</div>')),
5151
usedComponents: new Set(),
5252
isInline: false,
53-
file: new ParseSourceFile('<div>{{foo}}</div>', util.getTestFilePath()),
53+
file: new ParseSourceFile('<div>{{foo}}</div>', decl.getSourceFile().fileName),
5454
}
5555
});
5656
});
@@ -69,7 +69,7 @@ runInEachFileSystem(() => {
6969
const info = analysis.get(decl);
7070
expect(info).toBeDefined();
7171
expect(info!.template.file)
72-
.toEqual(new ParseSourceFile('class C {}', util.getTestFilePath()));
72+
.toEqual(new ParseSourceFile('class C {}', decl.getSourceFile().fileName));
7373
});
7474

7575
it('should give external templates their own source file', () => {
@@ -84,7 +84,7 @@ runInEachFileSystem(() => {
8484
const info = analysis.get(decl);
8585
expect(info).toBeDefined();
8686
expect(info!.template.file)
87-
.toEqual(new ParseSourceFile('<div>{{foo}}</div>', util.getTestFilePath()));
87+
.toEqual(new ParseSourceFile('<div>{{foo}}</div>', decl.getSourceFile().fileName));
8888
});
8989

9090
it('should emit used components', () => {

‎packages/compiler-cli/src/ngtsc/indexer/test/util.ts‎

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)