test: fix tests in windows ci (#30451)

PR Close #30451
This commit is contained in:
Alan 2019-05-14 14:21:30 +02:00 committed by Alex Rickabaugh
parent 06efc340b6
commit c7f9a95a3f
3 changed files with 9 additions and 7 deletions

View File

@ -5,10 +5,12 @@
* Use of this source code is governed by an MIT-style license that can be * Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {AbsoluteFsPath} from '../../../src/ngtsc/path';
import {makeEntryPointBundle} from '../../src/packages/entry_point_bundle'; import {makeEntryPointBundle} from '../../src/packages/entry_point_bundle';
import {MockFileSystem} from '../helpers/mock_file_system'; import {MockFileSystem} from '../helpers/mock_file_system';
const _ = AbsoluteFsPath.from;
function createMockFileSystem() { function createMockFileSystem() {
return new MockFileSystem({ return new MockFileSystem({
'/node_modules/test': { '/node_modules/test': {
@ -102,7 +104,7 @@ describe('entry point bundle', () => {
// Modules resolved from "other" should be declaration files // Modules resolved from "other" should be declaration files
'/node_modules/other/public_api.d.ts', '/node_modules/other/public_api.d.ts',
'/node_modules/other/index.d.ts', '/node_modules/other/index.d.ts',
])); ].map(p => _(p).toString())));
expect(esm5bundle.dts !.program.getSourceFiles().map(sf => sf.fileName)) expect(esm5bundle.dts !.program.getSourceFiles().map(sf => sf.fileName))
.toEqual(jasmine.arrayWithExactContents([ .toEqual(jasmine.arrayWithExactContents([
@ -115,6 +117,6 @@ describe('entry point bundle', () => {
'/node_modules/test/secondary/index.d.ts', '/node_modules/test/secondary/index.d.ts',
'/node_modules/other/public_api.d.ts', '/node_modules/other/public_api.d.ts',
'/node_modules/other/index.d.ts', '/node_modules/other/index.d.ts',
])); ].map(p => _(p).toString())));
}); });
}); });

View File

@ -67,7 +67,7 @@ export class LogicalFileSystem {
* `logicalPathOfFile(AbsoluteFsPath.fromSourceFile(sf))`. * `logicalPathOfFile(AbsoluteFsPath.fromSourceFile(sf))`.
*/ */
logicalPathOfSf(sf: ts.SourceFile): LogicalProjectPath|null { logicalPathOfSf(sf: ts.SourceFile): LogicalProjectPath|null {
return this.logicalPathOfFile(sf.fileName as AbsoluteFsPath); return this.logicalPathOfFile(AbsoluteFsPath.from(sf.fileName));
} }
/** /**

View File

@ -49,7 +49,7 @@ export class NgtscTestEnvironment {
*/ */
static setup(): NgtscTestEnvironment { static setup(): NgtscTestEnvironment {
const support = setup(); const support = setup();
const outDir = path.join(support.basePath, 'built'); const outDir = path.posix.join(support.basePath, 'built');
process.chdir(support.basePath); process.chdir(support.basePath);
setupFakeCore(support); setupFakeCore(support);
@ -133,7 +133,7 @@ export class NgtscTestEnvironment {
write(fileName: string, content: string) { write(fileName: string, content: string) {
if (this.multiCompileHostExt !== null) { if (this.multiCompileHostExt !== null) {
const absFilePath = path.resolve(this.support.basePath, fileName); const absFilePath = path.posix.resolve(this.support.basePath, fileName);
this.multiCompileHostExt.invalidate(absFilePath); this.multiCompileHostExt.invalidate(absFilePath);
} }
this.support.write(fileName, content); this.support.write(fileName, content);
@ -143,7 +143,7 @@ export class NgtscTestEnvironment {
if (this.multiCompileHostExt === null) { if (this.multiCompileHostExt === null) {
throw new Error(`Not caching files - call enableMultipleCompilations()`); throw new Error(`Not caching files - call enableMultipleCompilations()`);
} }
const fullFile = path.join(this.support.basePath, fileName); const fullFile = path.posix.join(this.support.basePath, fileName);
this.multiCompileHostExt.invalidate(fullFile); this.multiCompileHostExt.invalidate(fullFile);
} }