mirror of
https://github.com/ChainSafe/lodestar.git
synced 2026-01-09 15:48:08 -05:00
test: use vitest workspace to run all tests (#7610)
**Motivation** Vitest workspaces is feature to mimic the package manager workspaces for the tests only. It provides following benefits: 1. Minimize the need the bunch of config files at every package root 2. Consolidate vitest configuration in project groups 3. Use consistent test configuration for all projects in the monorepo 4. Providing consistent test environment for all packages 5. Speed up visual interaction with tests in the IDEs (e.g. Visual Studio Code) **Description** - Remove all unnecessary config files - Update package json scripts to use `--project` flag Closes #7603 Now we have following test directories. | Directory | Description | CurrentPreset | Old Preset | |---|---|---|---| | test/unit | Unit tests | minimal | Default export from `params` package | | test/unit-mainnet | Unit tests | mainnet | mainnet | | test/e2e | End-to-End Tests | minimal | Default export from `params` package | | test/e2e-mainnet | End-to-End Tests | mainnet | Never existed before, mixed up pattern in different packages | | test/spec | Spec tests | minimal | Default export from `params` package, but common perception among team was that it's running with `minimal` | | test/spec-mainnet` | Spec tests | mainnet | Never existed as directory, but mixed up among packages | | test/browser | Symlink to `unit` for packages which supports browsers | minimal | Default export from `params` package | | test/types | Types test | minimal | Default export from `params` package | **Steps to test or reproduce** Run all tests
This commit is contained in:
@@ -53,9 +53,9 @@
|
||||
"lint": "biome check src/ test/",
|
||||
"lint:fix": "yarn run lint --write",
|
||||
"test": "yarn test:unit",
|
||||
"test:unit": "vitest run --dir test/unit/",
|
||||
"test:browsers": "vitest run --config ./vitest.browser.config.ts --dir test/unit",
|
||||
"test:e2e": "vitest run --config vitest.e2e.config.ts --dir test/e2e/",
|
||||
"test:unit": "vitest run --project unit",
|
||||
"test:browsers": "vitest run --project browser",
|
||||
"test:e2e": "vitest run --project e2e",
|
||||
"check-readme": "typescript-docs-verifier"
|
||||
},
|
||||
"repository": {
|
||||
|
||||
1
packages/params/test/browser
Symbolic link
1
packages/params/test/browser
Symbolic link
@@ -0,0 +1 @@
|
||||
./unit
|
||||
@@ -1,2 +0,0 @@
|
||||
export async function setup(): Promise<void> {}
|
||||
export async function teardown(): Promise<void> {}
|
||||
@@ -1,14 +0,0 @@
|
||||
import {defineConfig, mergeConfig} from "vitest/config";
|
||||
import vitestConfig from "../../configs/vitest.config.base.browser";
|
||||
|
||||
export default mergeConfig(
|
||||
vitestConfig,
|
||||
defineConfig({
|
||||
test: {
|
||||
globalSetup: ["./test/globalSetup.ts"],
|
||||
},
|
||||
optimizeDeps: {
|
||||
exclude: ["@chainsafe/blst"],
|
||||
},
|
||||
})
|
||||
);
|
||||
@@ -1,11 +0,0 @@
|
||||
import {defineConfig, mergeConfig} from "vitest/config";
|
||||
import vitestConfig from "../../configs/vitest.config.base.unit";
|
||||
|
||||
export default mergeConfig(
|
||||
vitestConfig,
|
||||
defineConfig({
|
||||
test: {
|
||||
globalSetup: ["./test/globalSetup.ts"],
|
||||
},
|
||||
})
|
||||
);
|
||||
@@ -1,11 +0,0 @@
|
||||
import {defineConfig, mergeConfig} from "vitest/config";
|
||||
import vitestConfig from "../../configs/vitest.config.base.e2e";
|
||||
|
||||
export default mergeConfig(
|
||||
vitestConfig,
|
||||
defineConfig({
|
||||
test: {
|
||||
globalSetup: ["./test/globalSetup.ts"],
|
||||
},
|
||||
})
|
||||
);
|
||||
Reference in New Issue
Block a user