test(compiler-cli): ensure reflection 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:
Pete Bacon Darwin 2020-05-06 22:22:08 +01:00 committed by Alex Rickabaugh
parent 9e43e4900e
commit f7815cf96d
1 changed files with 3 additions and 3 deletions

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import * as ts from 'typescript';
import {absoluteFrom} from '../../file_system';
import {absoluteFrom, getSourceFileOrError} from '../../file_system';
import {runInEachFileSystem} from '../../file_system/testing';
import {getDeclaration, makeProgram} from '../../testing';
import {CtorParameter} from '../src/host';
@ -329,8 +329,8 @@ runInEachFileSystem(() => {
} else if (directTargetDecl === null) {
return fail('No declaration found for DirectTarget');
}
expect(targetDecl.node!.getSourceFile().fileName)
.toBe(_('/node_modules/absolute/index.ts'));
expect(targetDecl.node!.getSourceFile())
.toBe(getSourceFileOrError(program, _('/node_modules/absolute/index.ts')));
expect(ts.isClassDeclaration(targetDecl.node!)).toBe(true);
expect(directTargetDecl.viaModule).toBe('absolute');
expect(directTargetDecl.node).toBe(targetDecl.node);