From a794b9d278796fa6e1fb36e558e45daade306d5a Mon Sep 17 00:00:00 2001 From: zackad Date: Thu, 8 Aug 2024 07:33:29 +0700 Subject: [PATCH] test: optimize test files lookup If you use nix flakes and enabling it using direnv, there will be `.devenv` and `.direnv` directories in your root project directory. By default vitest will try to look for test files in all directories unless it is being excluded. Unfortunately `.devenv` and `.direnv` is not on that list. All we need is just tell vitest only to look for in `tests` directory. --- CHANGELOG.md | 3 +++ vitest.config.js | 1 + 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8352144f..49ce0ea4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## unreleased +### Internals +- Optimize test runner by defining where to look for test files + --- ## 0.7.0 (2024-08-01) diff --git a/vitest.config.js b/vitest.config.js index ec7c3179..42c3fea8 100644 --- a/vitest.config.js +++ b/vitest.config.js @@ -11,6 +11,7 @@ export default defineConfig({ } }, test: { + dir: "tests", setupFiles: ["./tests_config/run_spec.js"], snapshotSerializers: ["./tests_config/raw-serializer.js"], testRegex: "jsfmt\\.spec\\.js$|__tests__/.*\\.js$"