From 0853ca3b8fbdd1184a71be586bb4acbbd6a22eb7 Mon Sep 17 00:00:00 2001 From: Fazza Razaq Amiarso <86255053+fazzaamiarso@users.noreply.github.com> Date: Fri, 25 Nov 2022 20:37:23 +0700 Subject: [PATCH] fix: extends timeout for timed out test (#208) * fix: extends timeout for timed out test * fix: add dependent script to turbo test * fix: disable threading for test * fix: add timeout to vitest config * chore: remove test-ci script * fix: extends timeout to validator vitest config * chore: conditionally disabling vitest threading on CI --- .github/workflows/build-and-test.yml | 2 +- package.json | 3 +-- packages/form/vitest.config.ts | 5 ++++- packages/validator/test/Validator.astro.test.ts | 12 ++++++++---- packages/validator/vitest.config.ts | 4 +++- turbo.json | 5 ++++- 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 7713730..de094bf 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -28,5 +28,5 @@ jobs: - run: npm ci - run: npm run clean - run: npm run check - - run: npm run test-ci + - run: npm run test - run: npm run lint diff --git a/package.json b/package.json index 3aef98b..bc9472e 100644 --- a/package.json +++ b/package.json @@ -28,8 +28,7 @@ "patch": "npm version patch -w", "minor": "npm version minor -w", "major": "npm version major -w", - "publish": "turbo run lint build test && npm publish --access public -w", - "test-ci": "npm run test --workspaces --if-present" + "publish": "turbo run lint build test && npm publish --access public -w" }, "license": "ISC", "workspaces": [ diff --git a/packages/form/vitest.config.ts b/packages/form/vitest.config.ts index 1d84d7d..cdd9a50 100644 --- a/packages/form/vitest.config.ts +++ b/packages/form/vitest.config.ts @@ -1,5 +1,8 @@ import { defineConfig } from 'vitest/config'; export default defineConfig({ - test: {}, + test: { + testTimeout: 30000, + threads: !process.env.CI, + }, }); diff --git a/packages/validator/test/Validator.astro.test.ts b/packages/validator/test/Validator.astro.test.ts index f8dc215..248c864 100644 --- a/packages/validator/test/Validator.astro.test.ts +++ b/packages/validator/test/Validator.astro.test.ts @@ -9,9 +9,13 @@ describe('Example Tests', () => { }); describe('Component test', async () => { - it('example component should not be empty', async () => { - component = await getComponentOutput('./Validator.astro'); - expect(component.html).not.to.equal('\n'); - }); + it( + 'example component should not be empty', + async () => { + component = await getComponentOutput('./Validator.astro'); + expect(component.html).not.to.equal('\n'); + }, + { timeout: 10000, retry: 3 } + ); }); }); diff --git a/packages/validator/vitest.config.ts b/packages/validator/vitest.config.ts index 1d84d7d..376ff24 100644 --- a/packages/validator/vitest.config.ts +++ b/packages/validator/vitest.config.ts @@ -1,5 +1,7 @@ import { defineConfig } from 'vitest/config'; export default defineConfig({ - test: {}, + test: { + testTimeout: 30000, + }, }); diff --git a/turbo.json b/turbo.json index 18f0065..56fa44a 100644 --- a/turbo.json +++ b/turbo.json @@ -17,7 +17,10 @@ "dev": { "cache": false }, - "test": {}, + "test": { + "env": ["CI"], + "outputs": [] + }, "check": {}, "clean": {} }