Skip to content

Commit

Permalink
fix(benchmark): disable type testing while benchmarking
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Dec 11, 2024
1 parent 8a6f5f1 commit 1dde33d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/vitest/src/node/config/resolveConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ export function resolveConfig(
}
// override test config
resolved.coverage.enabled = false
resolved.typecheck.enabled = false
resolved.include = resolved.benchmark.include
resolved.exclude = resolved.benchmark.exclude
resolved.includeSource = resolved.benchmark.includeSource
Expand Down
7 changes: 7 additions & 0 deletions test/benchmark/fixtures/basic/should-not-run.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { describe, expectTypeOf, test } from 'vitest'

describe('test', () => {
test('some-test', () => {
expectTypeOf({ a: 1 }).toEqualTypeOf({ a: "should not match" })

Check failure on line 5 in test/benchmark/fixtures/basic/should-not-run.test-d.ts

View workflow job for this annotation

GitHub Actions / Lint: node-latest, ubuntu-latest

Object literal may only specify known properties, and 'a' does not exist in type 'Mismatch'.
})
})
3 changes: 3 additions & 0 deletions test/benchmark/test/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ it('basic', { timeout: 60_000 }, async () => {
root,
allowOnly: true,
outputJson: 'bench.json',

// Verify that type testing cannot be used with benchmark
typecheck: { enabled: true },
}, [], 'benchmark')
expect(result.exitCode).toBe(0)

Expand Down

0 comments on commit 1dde33d

Please sign in to comment.