Skip to content

Commit 8d89434

Browse files
lindseywildCopilot
andcommitted
Skip site-with-errors test when cache fixture is unavailable
Use describe.runIf to gracefully skip the integration test suite when CACHE_PATH is unset or the file doesn't exist, instead of failing with an assertion error in beforeAll. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent bb1f458 commit 8d89434

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

tests/site-with-errors.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ function createOctokit(): InstanceType<typeof OctokitWithThrottling> {
2828
})
2929
}
3030

31-
describe('site-with-errors', () => {
31+
const cachePathExists = !!process.env.CACHE_PATH && fs.existsSync(process.env.CACHE_PATH)
32+
33+
describe.runIf(cachePathExists)('site-with-errors', () => {
3234
let results: Result[]
3335

3436
beforeAll(() => {
35-
expect(process.env.CACHE_PATH).toBeDefined()
36-
expect(fs.existsSync(process.env.CACHE_PATH!)).toBe(true)
3737
results = JSON.parse(fs.readFileSync(process.env.CACHE_PATH!, 'utf-8'))
3838
})
3939

0 commit comments

Comments
 (0)