From d06446441c06bf3e50c11e85f6e926e0907483a0 Mon Sep 17 00:00:00 2001 From: William Grant Date: Thu, 20 Jul 2023 13:37:48 +1000 Subject: [PATCH 1/2] fix: resolved macOS config folder path for integration tests we should use path.join instead of a hard strings for the application support folder --- ts/test/automation/setup/beforeEach.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ts/test/automation/setup/beforeEach.ts b/ts/test/automation/setup/beforeEach.ts index f47f97418..6ba353549 100644 --- a/ts/test/automation/setup/beforeEach.ts +++ b/ts/test/automation/setup/beforeEach.ts @@ -1,5 +1,5 @@ import { Page } from '@playwright/test'; -import { readdirSync, rmdirSync } from 'fs-extra'; +import { readdirSync, rm } from 'fs-extra'; import { join } from 'path'; import { homedir } from 'os'; import { isLinux, isMacOS } from '../../../OS'; @@ -25,9 +25,9 @@ function cleanUpOtherTest() { alreadyCleanedWaiting = true; const parentFolderOfAllDataPath = isMacOS() - ? '~/Library/Application Support/' + ? join(homedir(), 'Library', 'Application Support') : isLinux() - ? `${homedir()}/.config/` + ? join(homedir(), '.config') : null; if (!parentFolderOfAllDataPath) { throw new Error('Only macOS is currrently supported '); @@ -43,7 +43,7 @@ function cleanUpOtherTest() { allAppDataPath.map(folder => { const pathToRemove = join(parentFolderOfAllDataPath, folder); - rmdirSync(pathToRemove, { recursive: true }); + rm(pathToRemove, { recursive: true }, () => pathToRemove); }); console.info('...done'); } From 90cf82f795aa33206b70b503c24ed168d3843a34 Mon Sep 17 00:00:00 2001 From: William Grant Date: Thu, 20 Jul 2023 14:22:58 +1000 Subject: [PATCH 2/2] fix: revert rm to rmdirSync so we don't remove config files before a test has been completed --- ts/test/automation/setup/beforeEach.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ts/test/automation/setup/beforeEach.ts b/ts/test/automation/setup/beforeEach.ts index 6ba353549..016cf072d 100644 --- a/ts/test/automation/setup/beforeEach.ts +++ b/ts/test/automation/setup/beforeEach.ts @@ -1,5 +1,5 @@ import { Page } from '@playwright/test'; -import { readdirSync, rm } from 'fs-extra'; +import { readdirSync, rmdirSync } from 'fs-extra'; import { join } from 'path'; import { homedir } from 'os'; import { isLinux, isMacOS } from '../../../OS'; @@ -43,7 +43,7 @@ function cleanUpOtherTest() { allAppDataPath.map(folder => { const pathToRemove = join(parentFolderOfAllDataPath, folder); - rm(pathToRemove, { recursive: true }, () => pathToRemove); + rmdirSync(pathToRemove, { recursive: true }); }); console.info('...done'); }