From 48df0692b90d475a68d231310898eafc3dacaf44 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Thu, 22 Dec 2022 16:16:09 +0100 Subject: [PATCH] repo-tools/chore: Update tests to pass on windows Signed-off-by: Johan Haals --- packages/repo-tools/src/lib/paths.test.ts | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/repo-tools/src/lib/paths.test.ts b/packages/repo-tools/src/lib/paths.test.ts index c642900612..7c75507a1d 100644 --- a/packages/repo-tools/src/lib/paths.test.ts +++ b/packages/repo-tools/src/lib/paths.test.ts @@ -15,7 +15,7 @@ */ import mockFs from 'mock-fs'; -import { resolve as resolvePath } from 'path'; +import { resolve as resolvePath, join } from 'path'; import { resolvePackagePath, paths, findPackageDirs } from './paths'; describe('paths', () => { @@ -61,15 +61,15 @@ describe('paths', () => { }); it('should return the path to the package if it exists and has a package.json', async () => { expect(await resolvePackagePath('packages/package-a')).toBe( - 'packages/package-a', + join('packages', 'package-a'), ); expect(await resolvePackagePath('packages/package-b')).toBe( - 'packages/package-b', + join('packages', 'package-b'), ); }); it('should work with absolute paths', async () => { expect(await resolvePackagePath('/root/packages/package-a')).toBe( - 'packages/package-a', + join('packages', 'package-a'), ); }); it('should return undefined if the pat is not a directory', async () => { @@ -79,19 +79,19 @@ describe('paths', () => { describe('findPackageDirs', () => { it('should return only the given packages', async () => { expect(await findPackageDirs(['packages/package-a'])).toEqual([ - 'packages/package-a', + join('packages', 'package-a'), ]); }); it('should return only the given packages when using glob patterns', async () => { expect(await findPackageDirs(['packages/*'])).toEqual([ - 'packages/package-a', - 'packages/package-b', + join('packages', 'package-a'), + join('packages', 'package-b'), ]); expect(await findPackageDirs(['packages/*', 'plugins/*'])).toEqual([ - 'packages/package-a', - 'packages/package-b', - 'plugins/plugin-a', - 'plugins/plugin-b', + join('packages', 'package-a'), + join('packages', 'package-b'), + join('plugins', 'plugin-a'), + join('plugins', 'plugin-b'), ]); }); it('should return only the given packages when using absolute paths', async () => { @@ -100,15 +100,15 @@ describe('paths', () => { '/root/packages/package-a', '/root/plugins/plugin-b', ]), - ).toEqual(['packages/package-a', 'plugins/plugin-b']); + ).toEqual([join('packages', 'package-a'), join('plugins', 'plugin-b')]); }); it('should return only the given packages when using absolute paths with glob patterns', async () => { expect( await findPackageDirs(['/root/packages/*', '/root/plugins/*-a']), ).toEqual([ - 'packages/package-a', - 'packages/package-b', - 'plugins/plugin-a', + join('packages', 'package-a'), + join('packages', 'package-b'), + join('plugins', 'plugin-a'), ]); }); });