Skip to content

Commit

Permalink
fix(test-time): Added caching by default and multi threading (#1120)
Browse files Browse the repository at this point in the history
* fix(test-time): Added caching by default and multi threading based on cpu

* Update

* Update

* Update
  • Loading branch information
benjaminpaige authored Feb 5, 2025
1 parent 93fe423 commit 89dba5b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ DS_Store

# tests
coverage
.vitest
13 changes: 13 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
import { cpus } from "os";
import { join } from "path";
import { configDefaults, defineConfig } from "vitest/config";

export default defineConfig({
test: {
globals: true,
environmentMatchGlobs: [["**/*.test.ts", "**/*.test.tsx"]],
cache: {
dir: ".vitest/cache",
},
testTimeout: 10000,
pool: "threads",
poolOptions: {
threads: {
singleThread: false,
isolate: true,
maxThreads: Math.max(1, Math.floor(cpus().length * 0.75)),
minThreads: Math.max(1, Math.floor(cpus().length * 0.5)),
},
},
coverage: {
provider: "istanbul",
reportsDirectory: join(__dirname, "coverage"),
Expand Down

0 comments on commit 89dba5b

Please sign in to comment.