Skip to content

Commit

Permalink
test: update test
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Oct 18, 2024
1 parent 46f07aa commit db8c0c7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
14 changes: 8 additions & 6 deletions test/config/test/failures.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,14 @@ test('coverage.autoUpdate cannot update thresholds when configuration file doesn
})

test('boolean flag 100 should not crash CLI', async () => {
const { stderr } = await runVitestCli('--coverage.enabled', '--coverage.thresholds.100')

expect(stderr).toMatch('ERROR: Coverage for lines (0%) does not meet global threshold (100%)')
expect(stderr).toMatch('ERROR: Coverage for functions (0%) does not meet global threshold (100%)')
expect(stderr).toMatch('ERROR: Coverage for statements (0%) does not meet global threshold (100%)')
expect(stderr).toMatch('ERROR: Coverage for branches (0%) does not meet global threshold (100%)')
let { stderr } = await runVitestCli('--coverage.enabled', '--coverage.thresholds.100')
// TODO: for some reason, non-zero coverage shows up, which is non-deterministic, so strip it.
stderr = stderr.replace(/\([0-9.]+%\) does/g, '(-%) does')

expect(stderr).toMatch('ERROR: Coverage for lines (-%) does not meet global threshold (100%)')
expect(stderr).toMatch('ERROR: Coverage for functions (-%) does not meet global threshold (100%)')
expect(stderr).toMatch('ERROR: Coverage for statements (-%) does not meet global threshold (100%)')
expect(stderr).toMatch('ERROR: Coverage for branches (-%) does not meet global threshold (100%)')
})

test('nextTick cannot be mocked inside child_process', async () => {
Expand Down
12 changes: 6 additions & 6 deletions test/coverage-test/test/vue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ test('coverage results matches snapshot', async () => {
expect({ lines, statements }).toMatchInlineSnapshot(`
{
"lines": {
"covered": 36,
"pct": 81.81,
"covered": 34,
"pct": 80.95,
"skipped": 0,
"total": 44,
"total": 42,
},
"statements": {
"covered": 36,
"pct": 81.81,
"covered": 34,
"pct": 80.95,
"skipped": 0,
"total": 44,
"total": 42,
},
}
`)
Expand Down

0 comments on commit db8c0c7

Please sign in to comment.