Skip to content

Commit fe64d97

Browse files
committed
(CI) more robust testing
1 parent 6176aaf commit fe64d97

12 files changed

+28
-20
lines changed

__tests__/build.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const isWin = process.platform === 'win32'
2-
jest.setTimeout(isWin ? 60000 : 30000)
1+
const { isCI } = require('ci-info')
2+
jest.setTimeout(isCI ? 60000 : 30000)
33

44
const runTests = require('./build.helper.js').runTests
55

__tests__/playwright/build.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { test } = require('@playwright/test')
2-
const isWin = process.platform === 'win32'
2+
const { isCI } = require('ci-info')
33
test.setTimeout(30000)
4-
test.slow(isWin)
4+
test.slow(isCI)
55

66
const runTests = require('./build.helper.js').runTests
77

__tests__/playwright/buildTS.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { test } = require('@playwright/test')
2-
const isWin = process.platform === 'win32'
2+
const { isCI } = require('ci-info')
33
test.setTimeout(30000)
4-
test.slow(isWin)
4+
test.slow(isCI)
55

66
const runTests = require('./build.helper.js').runTests
77

__tests__/playwright/serve.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { test } = require('@playwright/test')
2-
const isWin = process.platform === 'win32'
2+
const { isCI } = require('ci-info')
33
test.setTimeout(30000)
4-
test.slow(isWin)
4+
test.slow(isCI)
55

66
const runTests = require('./serve.helper.js').runTests
77

__tests__/playwright/serveTS.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { test } = require('@playwright/test')
2-
const isWin = process.platform === 'win32'
2+
const { isCI } = require('ci-info')
33
test.setTimeout(30000)
4-
test.slow(isWin)
4+
test.slow(isCI)
55

66
const runTests = require('./serve.helper.js').runTests
77

__tests__/playwright/testWithPlaywright.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { test } from '@playwright/test'
2-
const isWin = process.platform === 'win32'
2+
const { isCI } = require('ci-info')
33
test.setTimeout(20000)
4-
test.slow(isWin)
4+
test.slow(isCI)
55

66
const runTestWithPlaywright = require('./testWithPlaywright.helper.js')
77

__tests__/serve.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const isWin = process.platform === 'win32'
2-
jest.setTimeout(isWin ? 60000 : 30000)
1+
const { isCI } = require('ci-info')
2+
jest.setTimeout(isCI ? 60000 : 30000)
33

44
const runTests = require('./serve.helper.js').runTests
55
test('electron:serve', async () => {

__tests__/serveTS.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const isWin = process.platform === 'win32'
2-
jest.setTimeout(isWin ? 60000 : 30000)
1+
const { isCI } = require('ci-info')
2+
jest.setTimeout(isCI ? 60000 : 30000)
33

44
const runTests = require('./serve.helper.js').runTests
55
test('electron:serve-ts', async () => {

__tests__/testWithPlaywright.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const isWin = process.platform === 'win32'
2-
jest.setTimeout(isWin ? 30000 : 15000)
1+
const { isCI } = require('ci-info')
2+
jest.setTimeout(isCI ? 30000 : 15000)
33

44
const createPlaywrightProject = require('./testWithPlaywright.helper.js')
55

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
"@vue/cli-test-utils": "^5.0.5",
7171
"@vue/eslint-config-typescript": "^12.0.0",
7272
"@vuepress/plugin-google-analytics": "^1.8.0",
73+
"ci-info": "^4.0.0",
7374
"electron": "^27.0.0",
7475
"electron-devtools-installer": "^3.1.0",
7576
"electron-playwright-helpers": "^1.5.5",

playwright.config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { defineConfig } from '@playwright/test'
2+
import { isCI, GITHUB_ACTIONS } from 'ci-info'
23

34
export default defineConfig({
45
maxFailures: 2,
5-
reporter: process.env.CI ? 'github' : 'list',
6+
reporter: isCI ? (GITHUB_ACTIONS ? 'github' : 'dot') : 'list',
67
testDir: './__tests__/playwright/',
7-
testMatch: ['**/*.spec.js']
8+
testMatch: ['**/*.spec.js'],
9+
workers: isCI ? 1 : undefined
810
})

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5039,6 +5039,11 @@ ci-info@^3.2.0:
50395039
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.3.0.tgz#b4ed1fb6818dea4803a55c623041f9165d2066b2"
50405040
integrity sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==
50415041

5042+
ci-info@^4.0.0:
5043+
version "4.0.0"
5044+
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-4.0.0.tgz#65466f8b280fc019b9f50a5388115d17a63a44f2"
5045+
integrity sha512-TdHqgGf9odd8SXNuxtUBVx8Nv+qZOejE6qyqiy5NtbYYQOeFa6zmHkxlPzmaLxWWHsU6nJmB7AETdVPi+2NBUg==
5046+
50425047
cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3:
50435048
version "1.0.4"
50445049
resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de"

0 commit comments

Comments
 (0)