Skip to content

Commit 6f54c28

Browse files
AndrewKushnirSplaktar
authored andcommitted
test(compiler-cli): disable one TypeChecker test on Windows due to path sensitivity issue (angular#38294)
This commit disables one TypeChecker test (added as a part of angular#38105) which make assertions about the filename while running on Windows. Such assertions are currently suffering from a case sensitivity issue. PR Close angular#38294
1 parent 1784195 commit 6f54c28

File tree

1 file changed

+42
-36
lines changed

1 file changed

+42
-36
lines changed

packages/compiler-cli/src/ngtsc/typecheck/test/type_checker_spec.ts

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9+
import {platform} from 'os';
10+
911
import {ErrorCode, ngErrorCode} from '../../diagnostics';
1012
import {absoluteFrom, absoluteFromSourceFile, getSourceFileOrError} from '../../file_system';
1113
import {runInEachFileSystem} from '../../file_system/testing';
1214
import {OptimizeFor} from '../api';
1315

1416
import {getClass, setup, TestDeclaration} from './test_utils';
1517

16-
runInEachFileSystem(() => {
18+
runInEachFileSystem(os => {
1719
describe('TemplateTypeChecker', () => {
1820
it('should batch diagnostic operations when requested in WholeProgram mode', () => {
1921
const file1 = absoluteFrom('/file1.ts');
@@ -169,45 +171,49 @@ runInEachFileSystem(() => {
169171
expect(diags[0].code).toBe(ngErrorCode(ErrorCode.INLINE_TCB_REQUIRED));
170172
});
171173

172-
it('should produce errors for components that require type constructor inlining', () => {
173-
const fileName = absoluteFrom('/main.ts');
174-
const dirFile = absoluteFrom('/dir.ts');
175-
const {program, templateTypeChecker} = setup(
176-
[
177-
{
178-
fileName,
179-
source: `export class Cmp {}`,
180-
templates: {'Cmp': '<div dir></div>'},
181-
declarations: [{
182-
name: 'TestDir',
183-
selector: '[dir]',
184-
file: dirFile,
185-
type: 'directive',
186-
}]
187-
},
188-
{
189-
fileName: dirFile,
190-
source: `
174+
// These tests are currently disabled when running in Windows mode as the assertions involving
175+
// the filename attached to the diagnostic are suffering from a case-sensitivity issue.
176+
if (os !== 'Windows' && platform() !== 'win32') {
177+
it('should produce errors for components that require type constructor inlining', () => {
178+
const fileName = absoluteFrom('/main.ts');
179+
const dirFile = absoluteFrom('/dir.ts');
180+
const {program, templateTypeChecker} = setup(
181+
[
182+
{
183+
fileName,
184+
source: `export class Cmp {}`,
185+
templates: {'Cmp': '<div dir></div>'},
186+
declarations: [{
187+
name: 'TestDir',
188+
selector: '[dir]',
189+
file: dirFile,
190+
type: 'directive',
191+
}]
192+
},
193+
{
194+
fileName: dirFile,
195+
source: `
191196
// A non-exported interface used as a type bound for a generic directive causes
192197
// an inline type constructor to be required.
193198
interface NotExported {}
194199
export class TestDir<T extends NotExported> {}`,
195-
templates: {},
196-
}
197-
],
198-
{inlining: false});
199-
const sf = getSourceFileOrError(program, fileName);
200-
const diags = templateTypeChecker.getDiagnosticsForFile(sf, OptimizeFor.WholeProgram);
201-
expect(diags.length).toBe(1);
202-
expect(diags[0].code).toBe(ngErrorCode(ErrorCode.INLINE_TYPE_CTOR_REQUIRED));
203-
204-
// The relatedInformation of the diagnostic should point to the directive which required the
205-
// inline type constructor.
206-
expect(diags[0].relatedInformation).not.toBeUndefined();
207-
expect(diags[0].relatedInformation!.length).toBe(1);
208-
expect(diags[0].relatedInformation![0].file).not.toBeUndefined();
209-
expect(absoluteFromSourceFile(diags[0].relatedInformation![0].file!)).toBe(dirFile);
210-
});
200+
templates: {},
201+
}
202+
],
203+
{inlining: false});
204+
const sf = getSourceFileOrError(program, fileName);
205+
const diags = templateTypeChecker.getDiagnosticsForFile(sf, OptimizeFor.WholeProgram);
206+
expect(diags.length).toBe(1);
207+
expect(diags[0].code).toBe(ngErrorCode(ErrorCode.INLINE_TYPE_CTOR_REQUIRED));
208+
209+
// The relatedInformation of the diagnostic should point to the directive which required
210+
// the inline type constructor.
211+
expect(diags[0].relatedInformation).not.toBeUndefined();
212+
expect(diags[0].relatedInformation!.length).toBe(1);
213+
expect(diags[0].relatedInformation![0].file).not.toBeUndefined();
214+
expect(absoluteFromSourceFile(diags[0].relatedInformation![0].file!)).toBe(dirFile);
215+
});
216+
}
211217
});
212218

213219
describe('template overrides', () => {

0 commit comments

Comments
 (0)