From c7f9a95a3f2cd5490ab2e5c174e62a1b7736cae0 Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 14 May 2019 14:21:30 +0200 Subject: [PATCH] test: fix tests in windows ci (#30451) PR Close #30451 --- .../ngcc/test/packages/entry_point_bundle_spec.ts | 8 +++++--- packages/compiler-cli/src/ngtsc/path/src/logical.ts | 2 +- packages/compiler-cli/test/ngtsc/env.ts | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/compiler-cli/ngcc/test/packages/entry_point_bundle_spec.ts b/packages/compiler-cli/ngcc/test/packages/entry_point_bundle_spec.ts index b976f9487a..4049ac9c25 100644 --- a/packages/compiler-cli/ngcc/test/packages/entry_point_bundle_spec.ts +++ b/packages/compiler-cli/ngcc/test/packages/entry_point_bundle_spec.ts @@ -5,10 +5,12 @@ * 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 */ - +import {AbsoluteFsPath} from '../../../src/ngtsc/path'; import {makeEntryPointBundle} from '../../src/packages/entry_point_bundle'; import {MockFileSystem} from '../helpers/mock_file_system'; +const _ = AbsoluteFsPath.from; + function createMockFileSystem() { return new MockFileSystem({ '/node_modules/test': { @@ -102,7 +104,7 @@ describe('entry point bundle', () => { // Modules resolved from "other" should be declaration files '/node_modules/other/public_api.d.ts', '/node_modules/other/index.d.ts', - ])); + ].map(p => _(p).toString()))); expect(esm5bundle.dts !.program.getSourceFiles().map(sf => sf.fileName)) .toEqual(jasmine.arrayWithExactContents([ @@ -115,6 +117,6 @@ describe('entry point bundle', () => { '/node_modules/test/secondary/index.d.ts', '/node_modules/other/public_api.d.ts', '/node_modules/other/index.d.ts', - ])); + ].map(p => _(p).toString()))); }); }); diff --git a/packages/compiler-cli/src/ngtsc/path/src/logical.ts b/packages/compiler-cli/src/ngtsc/path/src/logical.ts index e00a74f4ed..4ad75a3f59 100644 --- a/packages/compiler-cli/src/ngtsc/path/src/logical.ts +++ b/packages/compiler-cli/src/ngtsc/path/src/logical.ts @@ -67,7 +67,7 @@ export class LogicalFileSystem { * `logicalPathOfFile(AbsoluteFsPath.fromSourceFile(sf))`. */ logicalPathOfSf(sf: ts.SourceFile): LogicalProjectPath|null { - return this.logicalPathOfFile(sf.fileName as AbsoluteFsPath); + return this.logicalPathOfFile(AbsoluteFsPath.from(sf.fileName)); } /** diff --git a/packages/compiler-cli/test/ngtsc/env.ts b/packages/compiler-cli/test/ngtsc/env.ts index 98e5f4bd0e..3daec54ab5 100644 --- a/packages/compiler-cli/test/ngtsc/env.ts +++ b/packages/compiler-cli/test/ngtsc/env.ts @@ -49,7 +49,7 @@ export class NgtscTestEnvironment { */ static setup(): NgtscTestEnvironment { const support = setup(); - const outDir = path.join(support.basePath, 'built'); + const outDir = path.posix.join(support.basePath, 'built'); process.chdir(support.basePath); setupFakeCore(support); @@ -133,7 +133,7 @@ export class NgtscTestEnvironment { write(fileName: string, content: string) { 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.support.write(fileName, content); @@ -143,7 +143,7 @@ export class NgtscTestEnvironment { if (this.multiCompileHostExt === null) { 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); }