From 28253c040e51b4a42f764c0acb14f27bca68b34a Mon Sep 17 00:00:00 2001 From: regexowl Date: Wed, 5 Feb 2025 09:28:59 +0100 Subject: [PATCH] vitests: Set global retry This sets retry globally to `3`, so we don't have to add it to the tests individually. For the tests that are reliable this shouldn't have any effect, but it will trigger on tests that proved to be a bit flakey (like revisit tests). --- .../Components/CreateImageWizard/steps/Oscap/Oscap.test.tsx | 4 ++-- .../steps/TargetEnvironment/AzureTarget.test.tsx | 2 +- src/test/Components/ImagesTable/ImagesTable.test.tsx | 2 +- vitest.config.ts | 4 +++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/test/Components/CreateImageWizard/steps/Oscap/Oscap.test.tsx b/src/test/Components/CreateImageWizard/steps/Oscap/Oscap.test.tsx index 00f9baa1..f4c8c11c 100644 --- a/src/test/Components/CreateImageWizard/steps/Oscap/Oscap.test.tsx +++ b/src/test/Components/CreateImageWizard/steps/Oscap/Oscap.test.tsx @@ -246,7 +246,7 @@ describe('OpenSCAP request generated correctly', () => { }); }); - test('remove a profile', { retry: 3, timeout: 20000 }, async () => { + test('remove a profile', { timeout: 20000 }, async () => { await renderCreateMode(); await selectGuestImageTarget(); await goToOscapStep(); @@ -265,7 +265,7 @@ describe('OpenSCAP request generated correctly', () => { }); }); - test('change profile', { retry: 3, timeout: 20000 }, async () => { + test('change profile', { timeout: 20000 }, async () => { await renderCreateMode(); await selectGuestImageTarget(); await goToOscapStep(); diff --git a/src/test/Components/CreateImageWizard/steps/TargetEnvironment/AzureTarget.test.tsx b/src/test/Components/CreateImageWizard/steps/TargetEnvironment/AzureTarget.test.tsx index f959dfa1..7c1346b0 100644 --- a/src/test/Components/CreateImageWizard/steps/TargetEnvironment/AzureTarget.test.tsx +++ b/src/test/Components/CreateImageWizard/steps/TargetEnvironment/AzureTarget.test.tsx @@ -220,7 +220,7 @@ describe('Step Upload to Azure', () => { await verifyCancelButton(router); }); - test('basics work', { retry: 3 }, async () => { + test('basics work', async () => { await renderCreateMode(); await selectAzureTarget(); await goToAzureStep(); diff --git a/src/test/Components/ImagesTable/ImagesTable.test.tsx b/src/test/Components/ImagesTable/ImagesTable.test.tsx index eb993ce2..4b15a30e 100644 --- a/src/test/Components/ImagesTable/ImagesTable.test.tsx +++ b/src/test/Components/ImagesTable/ImagesTable.test.tsx @@ -118,7 +118,7 @@ describe('Images Table', () => { expect(await screen.findByText(/ami-0e778053cd490ad21/i)).not.toBeVisible(); }); - test('check error details', { retry: 3 }, async () => { + test('check error details', async () => { await renderCustomRoutesWithReduxRouter(); let table = await screen.findByTestId('images-table'); diff --git a/vitest.config.ts b/vitest.config.ts index 0d67068c..6b3149ff 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,6 +1,7 @@ -import react from '@vitejs/plugin-react'; import path from 'path'; +import react from '@vitejs/plugin-react'; + const config = { plugins: [react()], test: { @@ -18,6 +19,7 @@ const config = { testTimeout: 10000, fileParallelism: false, exclude: ['./pkg/lib/**', '**/node_modules/**', '**/dist/**'], + retry: 3, }, reporters: ['default', 'junit'], outputFile: {