From bf446cb2d5a34f3858f986dfb20c3b6d4d1b618b Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Fri, 8 May 2020 13:33:53 +0100 Subject: [PATCH] Revert "test(compiler-cli): ensure indexer tests are not brittle to case-sensitivity (#36968)" (#37003) This reverts commit 3361f59a4f26c181f22dfe6181592f82ec115798. The changes to the case-sensitivity handling in #36968 caused multiple projects to fail to build. See #36992, #36993 and #37000. The issue is related to the logical path handling. But it is felt that it is safer to revert the entire PR and then to investigate further. PR Close #37003 --- .../src/ngtsc/indexer/test/context_spec.ts | 4 ++-- .../src/ngtsc/indexer/test/transform_spec.ts | 10 +++++----- packages/compiler-cli/src/ngtsc/indexer/test/util.ts | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/compiler-cli/src/ngtsc/indexer/test/context_spec.ts b/packages/compiler-cli/src/ngtsc/indexer/test/context_spec.ts index 8ce7582a4e..b95fb7502c 100644 --- a/packages/compiler-cli/src/ngtsc/indexer/test/context_spec.ts +++ b/packages/compiler-cli/src/ngtsc/indexer/test/context_spec.ts @@ -23,7 +23,7 @@ runInEachFileSystem(() => { boundTemplate, templateMeta: { isInline: false, - file: new ParseSourceFile('
', declaration.getSourceFile().fileName), + file: new ParseSourceFile('
', util.getTestFilePath()), }, }); @@ -34,7 +34,7 @@ runInEachFileSystem(() => { boundTemplate, templateMeta: { isInline: false, - file: new ParseSourceFile('
', declaration.getSourceFile().fileName), + file: new ParseSourceFile('
', util.getTestFilePath()), }, }, ])); diff --git a/packages/compiler-cli/src/ngtsc/indexer/test/transform_spec.ts b/packages/compiler-cli/src/ngtsc/indexer/test/transform_spec.ts index c788ed8eb7..8dac5ec4b5 100644 --- a/packages/compiler-cli/src/ngtsc/indexer/test/transform_spec.ts +++ b/packages/compiler-cli/src/ngtsc/indexer/test/transform_spec.ts @@ -25,7 +25,7 @@ function populateContext( boundTemplate, templateMeta: { isInline, - file: new ParseSourceFile(template, component.getSourceFile().fileName), + file: new ParseSourceFile(template, util.getTestFilePath()), }, }); } @@ -45,12 +45,12 @@ runInEachFileSystem(() => { expect(info).toEqual({ name: 'C', selector: 'c-selector', - file: new ParseSourceFile('class C {}', decl.getSourceFile().fileName), + file: new ParseSourceFile('class C {}', util.getTestFilePath()), template: { identifiers: getTemplateIdentifiers(util.getBoundTemplate('
{{foo}}
')), usedComponents: new Set(), isInline: false, - file: new ParseSourceFile('
{{foo}}
', decl.getSourceFile().fileName), + file: new ParseSourceFile('
{{foo}}
', util.getTestFilePath()), } }); }); @@ -69,7 +69,7 @@ runInEachFileSystem(() => { const info = analysis.get(decl); expect(info).toBeDefined(); expect(info!.template.file) - .toEqual(new ParseSourceFile('class C {}', decl.getSourceFile().fileName)); + .toEqual(new ParseSourceFile('class C {}', util.getTestFilePath())); }); 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('
{{foo}}
', decl.getSourceFile().fileName)); + .toEqual(new ParseSourceFile('
{{foo}}
', util.getTestFilePath())); }); it('should emit used components', () => { diff --git a/packages/compiler-cli/src/ngtsc/indexer/test/util.ts b/packages/compiler-cli/src/ngtsc/indexer/test/util.ts index e6298e7843..67b200f39f 100644 --- a/packages/compiler-cli/src/ngtsc/indexer/test/util.ts +++ b/packages/compiler-cli/src/ngtsc/indexer/test/util.ts @@ -16,7 +16,7 @@ import {getDeclaration, makeProgram} from '../../testing'; import {ComponentMeta} from '../src/context'; /** Dummy file URL */ -function getTestFilePath(): AbsoluteFsPath { +export function getTestFilePath(): AbsoluteFsPath { return absoluteFrom('/TEST_FILE.ts'); }