From 0bb76c24e60c0cfc64fc0abb9e5db3008ce3f03a Mon Sep 17 00:00:00 2001 From: Jason Dreyzehner Date: Tue, 13 Mar 2018 18:12:09 -0400 Subject: [PATCH] test(integration): use normalize from 'path' module rather than custom implementation --- src/cli/tests/cli.integration.spec.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/cli/tests/cli.integration.spec.ts b/src/cli/tests/cli.integration.spec.ts index f082246..3511c7b 100644 --- a/src/cli/tests/cli.integration.spec.ts +++ b/src/cli/tests/cli.integration.spec.ts @@ -20,7 +20,7 @@ import execa from 'execa'; import globby from 'globby'; import md5File from 'md5-file'; import meow from 'meow'; -import { join, relative } from 'path'; +import { join, normalize, relative } from 'path'; import { cloneRepo, Placeholders, Tasks } from '../tasks'; import { typescriptStarter } from '../typescript-starter'; import { Runner } from '../utils'; @@ -108,7 +108,9 @@ async function hashAllTheThings( const hashes = await Promise.all(hashAll); return hashes.reduce<{ readonly [filename: string]: string }>( (acc, hash, i) => { - const trimmedNormalizedFilePath = normalizePath(relative(buildDir, filePaths[i])); + const trimmedNormalizedFilePath = normalize( + relative(buildDir, filePaths[i]) + ); return { ...acc, [trimmedNormalizedFilePath]: hash @@ -118,11 +120,6 @@ async function hashAllTheThings( ); } -// On Windows, convert backslashes to forward slashes -function normalizePath(p: string) { - return process.platform === 'win32' ? p.replace(/\\/g, '/') : p; -} - test(`${ TestDirectories.one }: parses CLI arguments, handles default options`, async t => {