fix(compiler): correctly calculate the out path on windows (#19601)

Fixes #19543
PR Close #19601
This commit is contained in:
Tobias Bosch
2017-10-06 15:12:32 -07:00
committed by Chuck Jazdzewski
parent d7eac7ee56
commit d30ce19231
2 changed files with 25 additions and 7 deletions

View File

@ -495,5 +495,17 @@ describe('ng program', () => {
const mapper = createSrcToOutPathMapper('/out', '/tmp/a/x.ts', '/a/x.js');
expect(mapper('/tmp/b/y.js')).toBe('/out/b/y.js');
});
it('should work on windows with normalized paths', () => {
const mapper =
createSrcToOutPathMapper('c:/tmp/out', 'c:/tmp/a/x.ts', 'c:/tmp/out/a/x.js', path.win32);
expect(mapper('c:/tmp/b/y.js')).toBe('c:\\tmp\\out\\b\\y.js');
});
it('should work on windows with non-normalized paths', () => {
const mapper = createSrcToOutPathMapper(
'c:\\tmp\\out', 'c:\\tmp\\a\\x.ts', 'c:\\tmp\\out\\a\\x.js', path.win32);
expect(mapper('c:\\tmp\\b\\y.js')).toBe('c:\\tmp\\out\\b\\y.js');
});
});
});