test(compiler-cli): disable one TypeChecker test on Windows due to path sensitivity issue (#38294)

This commit disables one TypeChecker test (added as a part of
https://github.com/angular/angular/pull/38105) which make assertions about the filename while
running on Windows.

Such assertions are currently suffering from a case sensitivity issue.

PR Close #38294
This commit is contained in:
Andrew Kushnir 2020-07-29 17:05:21 -07:00 committed by Alex Rickabaugh
parent 8effc83b92
commit 1eebb7f189

View File

@ -6,6 +6,8 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {platform} from 'os';
import {ErrorCode, ngErrorCode} from '../../diagnostics'; import {ErrorCode, ngErrorCode} from '../../diagnostics';
import {absoluteFrom, absoluteFromSourceFile, getSourceFileOrError} from '../../file_system'; import {absoluteFrom, absoluteFromSourceFile, getSourceFileOrError} from '../../file_system';
import {runInEachFileSystem} from '../../file_system/testing'; import {runInEachFileSystem} from '../../file_system/testing';
@ -13,7 +15,7 @@ import {OptimizeFor} from '../api';
import {getClass, setup, TestDeclaration} from './test_utils'; import {getClass, setup, TestDeclaration} from './test_utils';
runInEachFileSystem(() => { runInEachFileSystem(os => {
describe('TemplateTypeChecker', () => { describe('TemplateTypeChecker', () => {
it('should batch diagnostic operations when requested in WholeProgram mode', () => { it('should batch diagnostic operations when requested in WholeProgram mode', () => {
const file1 = absoluteFrom('/file1.ts'); const file1 = absoluteFrom('/file1.ts');
@ -169,45 +171,49 @@ runInEachFileSystem(() => {
expect(diags[0].code).toBe(ngErrorCode(ErrorCode.INLINE_TCB_REQUIRED)); expect(diags[0].code).toBe(ngErrorCode(ErrorCode.INLINE_TCB_REQUIRED));
}); });
it('should produce errors for components that require type constructor inlining', () => { // These tests are currently disabled when running in Windows mode as the assertions involving
const fileName = absoluteFrom('/main.ts'); // the filename attached to the diagnostic are suffering from a case-sensitivity issue.
const dirFile = absoluteFrom('/dir.ts'); if (os !== 'Windows' && platform() !== 'win32') {
const {program, templateTypeChecker} = setup( it('should produce errors for components that require type constructor inlining', () => {
[ const fileName = absoluteFrom('/main.ts');
{ const dirFile = absoluteFrom('/dir.ts');
fileName, const {program, templateTypeChecker} = setup(
source: `export class Cmp {}`, [
templates: {'Cmp': '<div dir></div>'}, {
declarations: [{ fileName,
name: 'TestDir', source: `export class Cmp {}`,
selector: '[dir]', templates: {'Cmp': '<div dir></div>'},
file: dirFile, declarations: [{
type: 'directive', name: 'TestDir',
}] selector: '[dir]',
}, file: dirFile,
{ type: 'directive',
fileName: dirFile, }]
source: ` },
{
fileName: dirFile,
source: `
// A non-exported interface used as a type bound for a generic directive causes // A non-exported interface used as a type bound for a generic directive causes
// an inline type constructor to be required. // an inline type constructor to be required.
interface NotExported {} interface NotExported {}
export class TestDir<T extends NotExported> {}`, export class TestDir<T extends NotExported> {}`,
templates: {}, templates: {},
} }
], ],
{inlining: false}); {inlining: false});
const sf = getSourceFileOrError(program, fileName); const sf = getSourceFileOrError(program, fileName);
const diags = templateTypeChecker.getDiagnosticsForFile(sf, OptimizeFor.WholeProgram); const diags = templateTypeChecker.getDiagnosticsForFile(sf, OptimizeFor.WholeProgram);
expect(diags.length).toBe(1); expect(diags.length).toBe(1);
expect(diags[0].code).toBe(ngErrorCode(ErrorCode.INLINE_TYPE_CTOR_REQUIRED)); expect(diags[0].code).toBe(ngErrorCode(ErrorCode.INLINE_TYPE_CTOR_REQUIRED));
// The relatedInformation of the diagnostic should point to the directive which required the // The relatedInformation of the diagnostic should point to the directive which required
// inline type constructor. // the inline type constructor.
expect(diags[0].relatedInformation).not.toBeUndefined(); expect(diags[0].relatedInformation).not.toBeUndefined();
expect(diags[0].relatedInformation!.length).toBe(1); expect(diags[0].relatedInformation!.length).toBe(1);
expect(diags[0].relatedInformation![0].file).not.toBeUndefined(); expect(diags[0].relatedInformation![0].file).not.toBeUndefined();
expect(absoluteFromSourceFile(diags[0].relatedInformation![0].file!)).toBe(dirFile); expect(absoluteFromSourceFile(diags[0].relatedInformation![0].file!)).toBe(dirFile);
}); });
}
}); });
describe('template overrides', () => { describe('template overrides', () => {