Skip to content

Commit 15c9927

Browse files
committed
test(ci): auto-skip cross-repo data tests when data directory missing or in CI
1 parent cab4133 commit 15c9927

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/data.spec.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
import test, { ExecutionContext } from 'ava'
2+
import fs from 'node:fs'
3+
import path from 'node:path'
24

35
import { default as puid } from './lib/puid'
46
import { dataIds, dataParams, fileBytes } from './lib/util'
57

68
// Allow skipping data-driven cross-repo tests in CI or when PUID_SKIP_DATA_TESTS is set
7-
const it = process.env.PUID_SKIP_DATA_TESTS ? test.skip : test
9+
// Also skip automatically if the cross-repo data directory is not present
10+
const dataRoot = path.join(__dirname, '..', '..', 'data')
11+
const skipData = !!process.env.PUID_SKIP_DATA_TESTS || !!process.env.CI || !!process.env.GITHUB_ACTIONS || !fs.existsSync(dataRoot)
12+
const it = skipData ? test.skip : test
813

914
const testData = (t: ExecutionContext, dataName: string) => {
1015
const params = dataParams(dataName)

0 commit comments

Comments
 (0)