diff --git a/__tests__/build.spec.js b/__tests__/build.spec.js index fb6a512..c4e8b44 100644 --- a/__tests__/build.spec.js +++ b/__tests__/build.spec.js @@ -1,5 +1,5 @@ -const isWin = process.platform === 'win32' -jest.setTimeout(isWin ? 60000 : 30000) +const { isCI } = require('ci-info') +jest.setTimeout(isCI ? 60000 : 30000) const runTests = require('./build.helper.js').runTests diff --git a/__tests__/playwright/build.spec.js b/__tests__/playwright/build.spec.js index 8a4b541..f66cc46 100644 --- a/__tests__/playwright/build.spec.js +++ b/__tests__/playwright/build.spec.js @@ -1,7 +1,7 @@ const { test } = require('@playwright/test') -const isWin = process.platform === 'win32' +const { isCI } = require('ci-info') test.setTimeout(30000) -test.slow(isWin) +test.slow(isCI) const runTests = require('./build.helper.js').runTests diff --git a/__tests__/playwright/buildTS.spec.js b/__tests__/playwright/buildTS.spec.js index e3af949..a527706 100644 --- a/__tests__/playwright/buildTS.spec.js +++ b/__tests__/playwright/buildTS.spec.js @@ -1,7 +1,7 @@ const { test } = require('@playwright/test') -const isWin = process.platform === 'win32' +const { isCI } = require('ci-info') test.setTimeout(30000) -test.slow(isWin) +test.slow(isCI) const runTests = require('./build.helper.js').runTests diff --git a/__tests__/playwright/serve.spec.js b/__tests__/playwright/serve.spec.js index 71f9319..7322751 100644 --- a/__tests__/playwright/serve.spec.js +++ b/__tests__/playwright/serve.spec.js @@ -1,7 +1,7 @@ const { test } = require('@playwright/test') -const isWin = process.platform === 'win32' +const { isCI } = require('ci-info') test.setTimeout(30000) -test.slow(isWin) +test.slow(isCI) const runTests = require('./serve.helper.js').runTests diff --git a/__tests__/playwright/serveTS.spec.js b/__tests__/playwright/serveTS.spec.js index c7ca819..7e431c8 100644 --- a/__tests__/playwright/serveTS.spec.js +++ b/__tests__/playwright/serveTS.spec.js @@ -1,7 +1,7 @@ const { test } = require('@playwright/test') -const isWin = process.platform === 'win32' +const { isCI } = require('ci-info') test.setTimeout(30000) -test.slow(isWin) +test.slow(isCI) const runTests = require('./serve.helper.js').runTests diff --git a/__tests__/playwright/testWithPlaywright.spec.js b/__tests__/playwright/testWithPlaywright.spec.js index 8f1d08b..246a4cc 100644 --- a/__tests__/playwright/testWithPlaywright.spec.js +++ b/__tests__/playwright/testWithPlaywright.spec.js @@ -1,7 +1,7 @@ import { test } from '@playwright/test' -const isWin = process.platform === 'win32' +const { isCI } = require('ci-info') test.setTimeout(20000) -test.slow(isWin) +test.slow(isCI) const runTestWithPlaywright = require('./testWithPlaywright.helper.js') diff --git a/__tests__/serve.spec.js b/__tests__/serve.spec.js index 3677577..a5ce668 100644 --- a/__tests__/serve.spec.js +++ b/__tests__/serve.spec.js @@ -1,5 +1,5 @@ -const isWin = process.platform === 'win32' -jest.setTimeout(isWin ? 60000 : 30000) +const { isCI } = require('ci-info') +jest.setTimeout(isCI ? 60000 : 30000) const runTests = require('./serve.helper.js').runTests test('electron:serve', async () => { diff --git a/__tests__/serveTS.spec.js b/__tests__/serveTS.spec.js index 0e63e73..f465624 100644 --- a/__tests__/serveTS.spec.js +++ b/__tests__/serveTS.spec.js @@ -1,5 +1,5 @@ -const isWin = process.platform === 'win32' -jest.setTimeout(isWin ? 60000 : 30000) +const { isCI } = require('ci-info') +jest.setTimeout(isCI ? 60000 : 30000) const runTests = require('./serve.helper.js').runTests test('electron:serve-ts', async () => { diff --git a/__tests__/testWithPlaywright.spec.js b/__tests__/testWithPlaywright.spec.js index fff1301..91a6c77 100644 --- a/__tests__/testWithPlaywright.spec.js +++ b/__tests__/testWithPlaywright.spec.js @@ -1,5 +1,5 @@ -const isWin = process.platform === 'win32' -jest.setTimeout(isWin ? 30000 : 15000) +const { isCI } = require('ci-info') +jest.setTimeout(isCI ? 30000 : 15000) const createPlaywrightProject = require('./testWithPlaywright.helper.js') diff --git a/package.json b/package.json index 5b4c42b..9870c0d 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,7 @@ "@vue/cli-test-utils": "^5.0.5", "@vue/eslint-config-typescript": "^12.0.0", "@vuepress/plugin-google-analytics": "^1.8.0", + "ci-info": "^4.0.0", "electron": "^27.0.0", "electron-devtools-installer": "^3.1.0", "electron-playwright-helpers": "^1.5.5", diff --git a/playwright.config.js b/playwright.config.js index 161ef12..5afbcba 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -1,8 +1,10 @@ import { defineConfig } from '@playwright/test' +import { isCI, GITHUB_ACTIONS } from 'ci-info' export default defineConfig({ maxFailures: 2, - reporter: process.env.CI ? 'github' : 'list', + reporter: isCI ? (GITHUB_ACTIONS ? 'github' : 'dot') : 'list', testDir: './__tests__/playwright/', - testMatch: ['**/*.spec.js'] + testMatch: ['**/*.spec.js'], + workers: isCI ? 1 : undefined }) diff --git a/yarn.lock b/yarn.lock index 3ca5631..dac7c3c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5039,6 +5039,11 @@ ci-info@^3.2.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.3.0.tgz#b4ed1fb6818dea4803a55c623041f9165d2066b2" integrity sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw== +ci-info@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-4.0.0.tgz#65466f8b280fc019b9f50a5388115d17a63a44f2" + integrity sha512-TdHqgGf9odd8SXNuxtUBVx8Nv+qZOejE6qyqiy5NtbYYQOeFa6zmHkxlPzmaLxWWHsU6nJmB7AETdVPi+2NBUg== + cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de"