From bb688f7b3befca8d0787a96ada4d77cff59b45e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Tue, 24 Oct 2023 11:43:44 +0200 Subject: [PATCH] just a few small windows build fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .changeset/sharp-chefs-attend.md | 5 +++++ packages/app-next/src/App.test.tsx | 4 ++++ .../backend-test-utils/src/filesystem/MockDirectory.ts | 2 +- packages/config-loader/src/sources/ConfigSources.test.ts | 8 ++++---- 4 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 .changeset/sharp-chefs-attend.md diff --git a/.changeset/sharp-chefs-attend.md b/.changeset/sharp-chefs-attend.md new file mode 100644 index 0000000000..2334344928 --- /dev/null +++ b/.changeset/sharp-chefs-attend.md @@ -0,0 +1,5 @@ +--- +'@backstage/backend-test-utils': patch +--- + +Ensure recursive deletion of temporary directories in tests diff --git a/packages/app-next/src/App.test.tsx b/packages/app-next/src/App.test.tsx index b3cef58fe1..350daaaecc 100644 --- a/packages/app-next/src/App.test.tsx +++ b/packages/app-next/src/App.test.tsx @@ -21,6 +21,10 @@ jest.mock('@backstage/plugin-graphiql', () => ({ GraphiQLIcon: () => null, })); +// Rarely, and only in windows CI, do these tests take slightly more than the +// default five seconds +jest.setTimeout(15_000); + describe('App', () => { it('should render', async () => { process.env = { diff --git a/packages/backend-test-utils/src/filesystem/MockDirectory.ts b/packages/backend-test-utils/src/filesystem/MockDirectory.ts index b066b9acd5..fff8a35a06 100644 --- a/packages/backend-test-utils/src/filesystem/MockDirectory.ts +++ b/packages/backend-test-utils/src/filesystem/MockDirectory.ts @@ -311,7 +311,7 @@ class MockDirectoryImpl { }; remove = (): void => { - fs.removeSync(this.#root); + fs.rmSync(this.#root, { recursive: true, force: true, maxRetries: 10 }); }; #transformInput(input: MockDirectoryContent[string]): MockEntry[] { diff --git a/packages/config-loader/src/sources/ConfigSources.test.ts b/packages/config-loader/src/sources/ConfigSources.test.ts index f095bbec42..4b14572666 100644 --- a/packages/config-loader/src/sources/ConfigSources.test.ts +++ b/packages/config-loader/src/sources/ConfigSources.test.ts @@ -93,7 +93,7 @@ describe('ConfigSources', () => { targets: [{ type: 'path', target: '/config.yaml' }], }), ), - ).toEqual([{ name: 'FileConfigSource', path: '/config.yaml' }]); + ).toEqual([{ name: 'FileConfigSource', path: `${root}config.yaml` }]); expect( mergeSources( @@ -201,9 +201,9 @@ describe('ConfigSources', () => { ]), ), ).toEqual([ - { name: 'FileConfigSource', path: '/a.yaml' }, - { name: 'FileConfigSource', path: '/b.yaml' }, - { name: 'FileConfigSource', path: '/c.yaml' }, + { name: 'FileConfigSource', path: `${root}a.yaml` }, + { name: 'FileConfigSource', path: `${root}b.yaml` }, + { name: 'FileConfigSource', path: `${root}c.yaml` }, ]); });