From 937df77e42cd724cef220c662e34513245824b93 Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Tue, 16 Jan 2024 19:54:13 +0100 Subject: [PATCH] Split the config files for each package --- packages/api/package.json | 2 +- packages/api/vitest.config.ts | 2 +- packages/beacon-node/package.json | 4 ++-- packages/beacon-node/vitest.config.e2e.ts | 11 ++++++++++ packages/beacon-node/vitest.config.spec.ts | 10 +-------- packages/beacon-node/vitest.config.ts | 2 +- packages/cli/package.json | 4 ++-- packages/cli/vitest.config.e2e.ts | 11 ++++++++++ packages/cli/vitest.config.ts | 2 +- packages/config/package.json | 2 +- packages/config/vitest.config.ts | 2 +- packages/db/package.json | 2 +- packages/db/vitest.config.ts | 2 +- packages/flare/package.json | 2 +- packages/flare/vitest.config.ts | 2 +- packages/fork-choice/package.json | 2 +- packages/fork-choice/vitest.config.ts | 2 +- packages/light-client/package.json | 2 +- packages/light-client/vitest.config.ts | 2 +- packages/logger/package.json | 4 ++-- packages/logger/vitest.config.e2e.ts | 11 ++++++++++ packages/logger/vitest.config.ts | 2 +- packages/params/package.json | 4 ++-- packages/params/vitest.config.e2e.ts | 11 ++++++++++ packages/params/vitest.config.ts | 2 +- packages/prover/package.json | 4 ++-- packages/prover/vitest.config.e2e.ts | 11 ++++++++++ packages/prover/vitest.config.ts | 2 +- packages/reqresp/package.json | 2 +- packages/reqresp/vitest.config.ts | 2 +- packages/spec-test-util/package.json | 4 ++-- packages/spec-test-util/vitest.config.e2e.ts | 11 ++++++++++ packages/spec-test-util/vitest.config.ts | 2 +- packages/state-transition/package.json | 2 +- packages/state-transition/vitest.config.ts | 2 +- packages/types/package.json | 6 ++--- packages/types/vitest.config.ts | 2 +- packages/utils/package.json | 2 +- packages/utils/vitest.config.ts | 2 +- packages/validator/package.json | 4 ++-- packages/validator/vitest.config.e2e.ts | 11 ++++++++++ packages/validator/vitest.config.spec.ts | 2 +- packages/validator/vitest.config.ts | 2 +- vitest.base.e2e.config.ts | 19 ++++++++++++++++ vitest.base.spec.config.ts | 22 +++++++++++++++++++ ...se.config.ts => vitest.base.unit.config.ts | 1 + 46 files changed, 164 insertions(+), 53 deletions(-) create mode 100644 packages/beacon-node/vitest.config.e2e.ts create mode 100644 packages/cli/vitest.config.e2e.ts create mode 100644 packages/logger/vitest.config.e2e.ts create mode 100644 packages/params/vitest.config.e2e.ts create mode 100644 packages/prover/vitest.config.e2e.ts create mode 100644 packages/spec-test-util/vitest.config.e2e.ts create mode 100644 packages/validator/vitest.config.e2e.ts create mode 100644 vitest.base.e2e.config.ts create mode 100644 vitest.base.spec.config.ts rename vitest.base.config.ts => vitest.base.unit.config.ts (96%) diff --git a/packages/api/package.json b/packages/api/package.json index b7708ac5aa26..e1a52c47b489 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -65,7 +65,7 @@ "lint:fix": "yarn run lint --fix", "pretest": "yarn run check-types", "test": "yarn test:unit && yarn test:e2e", - "test:unit": "vitest --run --dir test/unit/ --coverage", + "test:unit": "vitest --run --dir test/unit/", "check-readme": "typescript-docs-verifier" }, "dependencies": { diff --git a/packages/api/vitest.config.ts b/packages/api/vitest.config.ts index 9f325a6477e2..c4a84957259d 100644 --- a/packages/api/vitest.config.ts +++ b/packages/api/vitest.config.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import vitestConfig from "../../vitest.base.config"; +import vitestConfig from "../../vitest.base.unit.config"; export default mergeConfig( vitestConfig, diff --git a/packages/beacon-node/package.json b/packages/beacon-node/package.json index d68c2bbd0d60..3ddde8540670 100644 --- a/packages/beacon-node/package.json +++ b/packages/beacon-node/package.json @@ -77,10 +77,10 @@ "lint:fix": "yarn run lint --fix", "pretest": "yarn run check-types", "test": "yarn test:unit && yarn test:e2e", - "test:unit:minimal": "vitest --run --segfaultRetry 3 --dir test/unit/ --coverage", + "test:unit:minimal": "vitest --run --segfaultRetry 3 --dir test/unit/", "test:unit:mainnet": "LODESTAR_PRESET=mainnet vitest --run --dir test/unit-mainnet", "test:unit": "wrapper() { yarn test:unit:minimal $@ && yarn test:unit:mainnet $@; }; wrapper", - "test:e2e": "LODESTAR_PRESET=minimal vitest --run --segfaultRetry 3 --poolOptions.threads.singleThread true --dir test/e2e", + "test:e2e": "LODESTAR_PRESET=minimal vitest --run --segfaultRetry 3 --config vitest.config.e2e.ts --dir test/e2e", "test:sim": "vitest --run test/sim/**/*.test.ts", "test:sim:merge-interop": "vitest --run test/sim/merge-interop.test.ts", "test:sim:mergemock": "vitest --run test/sim/mergemock.test.ts", diff --git a/packages/beacon-node/vitest.config.e2e.ts b/packages/beacon-node/vitest.config.e2e.ts new file mode 100644 index 000000000000..b9f913705ef2 --- /dev/null +++ b/packages/beacon-node/vitest.config.e2e.ts @@ -0,0 +1,11 @@ +import {defineConfig, mergeConfig} from "vitest/config"; +import vitestConfig from "../../vitest.base.e2e.config"; + +export default mergeConfig( + vitestConfig, + defineConfig({ + test: { + globalSetup: ["./test/globalSetup.ts"], + }, + }) +); diff --git a/packages/beacon-node/vitest.config.spec.ts b/packages/beacon-node/vitest.config.spec.ts index e5f588d17155..f4f301c7985f 100644 --- a/packages/beacon-node/vitest.config.spec.ts +++ b/packages/beacon-node/vitest.config.spec.ts @@ -1,19 +1,11 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import vitestConfig from "../../vitest.base.config"; +import vitestConfig from "../../vitest.base.spec.config"; export default mergeConfig( vitestConfig, defineConfig({ test: { globalSetup: ["./test/globalSetup.ts"], - testTimeout: 60_000, - passWithNoTests: true, - pool: "threads", - poolOptions: { - threads: { - isolate: false, - }, - }, }, }) ); diff --git a/packages/beacon-node/vitest.config.ts b/packages/beacon-node/vitest.config.ts index 1df0de848936..7a6069341168 100644 --- a/packages/beacon-node/vitest.config.ts +++ b/packages/beacon-node/vitest.config.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import vitestConfig from "../../vitest.base.config"; +import vitestConfig from "../../vitest.base.unit.config"; export default mergeConfig( vitestConfig, diff --git a/packages/cli/package.json b/packages/cli/package.json index 594ef5ebbb67..243dee688417 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -31,8 +31,8 @@ "lint": "eslint --color --ext .ts src/ test/", "lint:fix": "yarn run lint --fix", "pretest": "yarn run check-types", - "test:unit": "vitest --run --dir test/unit/ --coverage", - "test:e2e": "vitest --run --poolOptions.threads.singleThread true --dir test/e2e/", + "test:unit": "vitest --run --dir test/unit/", + "test:e2e": "vitest --run --config vitest.config.e2e.ts --dir test/e2e/", "test:sim:multifork": "LODESTAR_PRESET=minimal node --loader ts-node/esm test/sim/multi_fork.test.ts", "test:sim:mixedclient": "LODESTAR_PRESET=minimal node --loader ts-node/esm test/sim/mixed_client.test.ts", "test:sim:endpoints": "LODESTAR_PRESET=minimal node --loader ts-node/esm test/sim/endpoints.test.ts", diff --git a/packages/cli/vitest.config.e2e.ts b/packages/cli/vitest.config.e2e.ts new file mode 100644 index 000000000000..b9f913705ef2 --- /dev/null +++ b/packages/cli/vitest.config.e2e.ts @@ -0,0 +1,11 @@ +import {defineConfig, mergeConfig} from "vitest/config"; +import vitestConfig from "../../vitest.base.e2e.config"; + +export default mergeConfig( + vitestConfig, + defineConfig({ + test: { + globalSetup: ["./test/globalSetup.ts"], + }, + }) +); diff --git a/packages/cli/vitest.config.ts b/packages/cli/vitest.config.ts index 1df0de848936..7a6069341168 100644 --- a/packages/cli/vitest.config.ts +++ b/packages/cli/vitest.config.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import vitestConfig from "../../vitest.base.config"; +import vitestConfig from "../../vitest.base.unit.config"; export default mergeConfig( vitestConfig, diff --git a/packages/config/package.json b/packages/config/package.json index ed79bd700cfb..c52a070b69fd 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -50,7 +50,7 @@ "lint": "eslint --color --ext .ts src/", "lint:fix": "yarn run lint --fix", "pretest": "yarn run check-types", - "test:unit": "yarn vitest --run --dir test/unit/ --coverage", + "test:unit": "yarn vitest --run --dir test/unit/", "check-readme": "typescript-docs-verifier" }, "repository": { diff --git a/packages/config/vitest.config.ts b/packages/config/vitest.config.ts index 1df0de848936..7a6069341168 100644 --- a/packages/config/vitest.config.ts +++ b/packages/config/vitest.config.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import vitestConfig from "../../vitest.base.config"; +import vitestConfig from "../../vitest.base.unit.config"; export default mergeConfig( vitestConfig, diff --git a/packages/db/package.json b/packages/db/package.json index 13ffff098279..d99b21d80b9b 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -33,7 +33,7 @@ "lint:fix": "yarn run lint --fix", "pretest": "yarn run check-types", "test": "yarn test:unit", - "test:unit": "vitest --run --dir test/unit/ --coverage", + "test:unit": "vitest --run --dir test/unit/", "check-readme": "typescript-docs-verifier" }, "dependencies": { diff --git a/packages/db/vitest.config.ts b/packages/db/vitest.config.ts index 1df0de848936..7a6069341168 100644 --- a/packages/db/vitest.config.ts +++ b/packages/db/vitest.config.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import vitestConfig from "../../vitest.base.config"; +import vitestConfig from "../../vitest.base.unit.config"; export default mergeConfig( vitestConfig, diff --git a/packages/flare/package.json b/packages/flare/package.json index d3849d1b5362..7417cf93c63d 100644 --- a/packages/flare/package.json +++ b/packages/flare/package.json @@ -44,7 +44,7 @@ "lint": "eslint --color --ext .ts src/", "lint:fix": "yarn run lint --fix", "pretest": "yarn run check-types", - "test:unit": "vitest --run --dir test/unit/ --coverage", + "test:unit": "vitest --run --dir test/unit/", "check-readme": "typescript-docs-verifier" }, "repository": { diff --git a/packages/flare/vitest.config.ts b/packages/flare/vitest.config.ts index 1df0de848936..7a6069341168 100644 --- a/packages/flare/vitest.config.ts +++ b/packages/flare/vitest.config.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import vitestConfig from "../../vitest.base.config"; +import vitestConfig from "../../vitest.base.unit.config"; export default mergeConfig( vitestConfig, diff --git a/packages/fork-choice/package.json b/packages/fork-choice/package.json index b19fa976bdf4..495c67a8e80b 100644 --- a/packages/fork-choice/package.json +++ b/packages/fork-choice/package.json @@ -34,7 +34,7 @@ "lint:fix": "yarn run lint --fix", "pretest": "yarn run check-types", "test": "yarn test:unit", - "test:unit": "vitest --run --dir test/unit/ --coverage", + "test:unit": "vitest --run --dir test/unit/", "check-readme": "typescript-docs-verifier" }, "dependencies": { diff --git a/packages/fork-choice/vitest.config.ts b/packages/fork-choice/vitest.config.ts index 1df0de848936..7a6069341168 100644 --- a/packages/fork-choice/vitest.config.ts +++ b/packages/fork-choice/vitest.config.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import vitestConfig from "../../vitest.base.config"; +import vitestConfig from "../../vitest.base.unit.config"; export default mergeConfig( vitestConfig, diff --git a/packages/light-client/package.json b/packages/light-client/package.json index f34fe11601e8..dee231409730 100644 --- a/packages/light-client/package.json +++ b/packages/light-client/package.json @@ -59,7 +59,7 @@ "lint:fix": "yarn run lint --fix", "pretest": "yarn run check-types", "test": "yarn test:unit && yarn test:e2e", - "test:unit": "vitest --run --dir test/unit/ --coverage", + "test:unit": "vitest --run --dir test/unit/", "test:browsers": "yarn test:browsers:chrome && yarn test:browsers:firefox && yarn test:browsers:electron", "test:browsers:chrome": "vitest --run --browser chrome --config ./vitest.browser.config.ts --dir test/unit", "test:browsers:firefox": "vitest --run --browser firefox --config ./vitest.browser.config.ts --dir test/unit", diff --git a/packages/light-client/vitest.config.ts b/packages/light-client/vitest.config.ts index 1df0de848936..7a6069341168 100644 --- a/packages/light-client/vitest.config.ts +++ b/packages/light-client/vitest.config.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import vitestConfig from "../../vitest.base.config"; +import vitestConfig from "../../vitest.base.unit.config"; export default mergeConfig( vitestConfig, diff --git a/packages/logger/package.json b/packages/logger/package.json index e8cc7d5f9622..2f450ee5be12 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -56,12 +56,12 @@ "lint": "eslint --color --ext .ts src/ test/", "lint:fix": "yarn run lint --fix", "pretest": "yarn run check-types", - "test:unit": "vitest --run --dir test/unit/ --coverage", + "test:unit": "vitest --run --dir test/unit/", "test:browsers": "yarn test:browsers:chrome && yarn test:browsers:firefox && yarn test:browsers:electron", "test:browsers:chrome": "vitest --run --browser chrome --config ./vitest.browser.config.ts --dir test/unit", "test:browsers:firefox": "vitest --run --browser firefox --config ./vitest.browser.config.ts --dir test/unit", "test:browsers:electron": "echo 'Electron tests will be introduced back in the future as soon vitest supports electron.'", - "test:e2e": "LODESTAR_PRESET=minimal vitest --run --dir test/e2e", + "test:e2e": "LODESTAR_PRESET=minimal vitest --run --config vitest.config.e2e.ts --dir test/e2e", "check-readme": "typescript-docs-verifier" }, "types": "lib/index.d.ts", diff --git a/packages/logger/vitest.config.e2e.ts b/packages/logger/vitest.config.e2e.ts new file mode 100644 index 000000000000..b9f913705ef2 --- /dev/null +++ b/packages/logger/vitest.config.e2e.ts @@ -0,0 +1,11 @@ +import {defineConfig, mergeConfig} from "vitest/config"; +import vitestConfig from "../../vitest.base.e2e.config"; + +export default mergeConfig( + vitestConfig, + defineConfig({ + test: { + globalSetup: ["./test/globalSetup.ts"], + }, + }) +); diff --git a/packages/logger/vitest.config.ts b/packages/logger/vitest.config.ts index 1df0de848936..7a6069341168 100644 --- a/packages/logger/vitest.config.ts +++ b/packages/logger/vitest.config.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import vitestConfig from "../../vitest.base.config"; +import vitestConfig from "../../vitest.base.unit.config"; export default mergeConfig( vitestConfig, diff --git a/packages/params/package.json b/packages/params/package.json index 7861da84424d..2586c73566aa 100644 --- a/packages/params/package.json +++ b/packages/params/package.json @@ -53,12 +53,12 @@ "lint": "eslint --color --ext .ts src/ test/", "lint:fix": "yarn run lint --fix", "test": "yarn run check-types", - "test:unit": "vitest --run --dir test/unit/ --coverage", + "test:unit": "vitest --run --dir test/unit/", "test:browsers": "yarn test:browsers:chrome && yarn test:browsers:firefox && yarn test:browsers:electron", "test:browsers:chrome": "vitest --run --browser chrome --config ./vitest.browser.config.ts --dir test/unit", "test:browsers:firefox": "vitest --run --browser firefox --config ./vitest.browser.config.ts --dir test/unit", "test:browsers:electron": "echo 'Electron tests will be introduced back in the future as soon vitest supports electron.'", - "test:e2e": "LODESTAR_PRESET=minimal vitest --run --dir test/e2e/", + "test:e2e": "LODESTAR_PRESET=minimal vitest --run --config vitest.config.e2e.ts --dir test/e2e/", "check-readme": "typescript-docs-verifier" }, "repository": { diff --git a/packages/params/vitest.config.e2e.ts b/packages/params/vitest.config.e2e.ts new file mode 100644 index 000000000000..b9f913705ef2 --- /dev/null +++ b/packages/params/vitest.config.e2e.ts @@ -0,0 +1,11 @@ +import {defineConfig, mergeConfig} from "vitest/config"; +import vitestConfig from "../../vitest.base.e2e.config"; + +export default mergeConfig( + vitestConfig, + defineConfig({ + test: { + globalSetup: ["./test/globalSetup.ts"], + }, + }) +); diff --git a/packages/params/vitest.config.ts b/packages/params/vitest.config.ts index 1df0de848936..7a6069341168 100644 --- a/packages/params/vitest.config.ts +++ b/packages/params/vitest.config.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import vitestConfig from "../../vitest.base.config"; +import vitestConfig from "../../vitest.base.unit.config"; export default mergeConfig( vitestConfig, diff --git a/packages/prover/package.json b/packages/prover/package.json index 80a992118202..05f7c33579b4 100644 --- a/packages/prover/package.json +++ b/packages/prover/package.json @@ -53,12 +53,12 @@ "lint:fix": "yarn run lint --fix", "pretest": "yarn run check-types", "test": "yarn test:unit && yarn test:e2e", - "test:unit": "vitest --run --dir test/unit/ --coverage", + "test:unit": "vitest --run --dir test/unit/", "test:browsers": "yarn test:browsers:chrome && yarn test:browsers:firefox && yarn test:browsers:electron", "test:browsers:chrome": "vitest --run --browser chrome --config ./vitest.browser.config.ts --dir test/unit", "test:browsers:firefox": "vitest --run --browser firefox --config ./vitest.browser.config.ts --dir test/unit", "test:browsers:electron": "echo 'Electron tests will be introduced back in the future as soon vitest supports electron.'", - "test:e2e": "LODESTAR_PRESET=minimal vitest --run --poolOptions.threads.singleThread true --dir test/e2e", + "test:e2e": "LODESTAR_PRESET=minimal vitest --run --config vitest.config.e2e.ts --dir test/e2e", "check-readme": "typescript-docs-verifier", "generate-fixtures": "node --loader ts-node/esm scripts/generate_fixtures.ts" }, diff --git a/packages/prover/vitest.config.e2e.ts b/packages/prover/vitest.config.e2e.ts new file mode 100644 index 000000000000..b9f913705ef2 --- /dev/null +++ b/packages/prover/vitest.config.e2e.ts @@ -0,0 +1,11 @@ +import {defineConfig, mergeConfig} from "vitest/config"; +import vitestConfig from "../../vitest.base.e2e.config"; + +export default mergeConfig( + vitestConfig, + defineConfig({ + test: { + globalSetup: ["./test/globalSetup.ts"], + }, + }) +); diff --git a/packages/prover/vitest.config.ts b/packages/prover/vitest.config.ts index 1df0de848936..7a6069341168 100644 --- a/packages/prover/vitest.config.ts +++ b/packages/prover/vitest.config.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import vitestConfig from "../../vitest.base.config"; +import vitestConfig from "../../vitest.base.unit.config"; export default mergeConfig( vitestConfig, diff --git a/packages/reqresp/package.json b/packages/reqresp/package.json index 8cea3d0d6072..c19af565c397 100644 --- a/packages/reqresp/package.json +++ b/packages/reqresp/package.json @@ -50,7 +50,7 @@ "lint:fix": "yarn run lint --fix", "pretest": "yarn run check-types", "test": "yarn test:unit", - "test:unit": "vitest --run --dir test/unit/ --coverage", + "test:unit": "vitest --run --dir test/unit/", "check-readme": "typescript-docs-verifier" }, "dependencies": { diff --git a/packages/reqresp/vitest.config.ts b/packages/reqresp/vitest.config.ts index 1df0de848936..7a6069341168 100644 --- a/packages/reqresp/vitest.config.ts +++ b/packages/reqresp/vitest.config.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import vitestConfig from "../../vitest.base.config"; +import vitestConfig from "../../vitest.base.unit.config"; export default mergeConfig( vitestConfig, diff --git a/packages/spec-test-util/package.json b/packages/spec-test-util/package.json index ab427e2d0a41..6056aa1e1ca4 100644 --- a/packages/spec-test-util/package.json +++ b/packages/spec-test-util/package.json @@ -47,8 +47,8 @@ "lint": "eslint --color --ext .ts src/ test/", "lint:fix": "yarn run lint --fix", "pretest": "yarn run check-types", - "test:unit": "vitest --run --passWithNoTests --dir test/unit/ --coverage", - "test:e2e": "vitest --run --dir test/e2e/", + "test:unit": "vitest --run --passWithNoTests --dir test/unit/", + "test:e2e": "vitest --run --config vitest.config.e2e.ts --dir test/e2e/", "check-readme": "typescript-docs-verifier" }, "repository": { diff --git a/packages/spec-test-util/vitest.config.e2e.ts b/packages/spec-test-util/vitest.config.e2e.ts new file mode 100644 index 000000000000..b9f913705ef2 --- /dev/null +++ b/packages/spec-test-util/vitest.config.e2e.ts @@ -0,0 +1,11 @@ +import {defineConfig, mergeConfig} from "vitest/config"; +import vitestConfig from "../../vitest.base.e2e.config"; + +export default mergeConfig( + vitestConfig, + defineConfig({ + test: { + globalSetup: ["./test/globalSetup.ts"], + }, + }) +); diff --git a/packages/spec-test-util/vitest.config.ts b/packages/spec-test-util/vitest.config.ts index 1df0de848936..7a6069341168 100644 --- a/packages/spec-test-util/vitest.config.ts +++ b/packages/spec-test-util/vitest.config.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import vitestConfig from "../../vitest.base.config"; +import vitestConfig from "../../vitest.base.unit.config"; export default mergeConfig( vitestConfig, diff --git a/packages/state-transition/package.json b/packages/state-transition/package.json index 2b49b94179ca..cbde9b062177 100644 --- a/packages/state-transition/package.json +++ b/packages/state-transition/package.json @@ -52,7 +52,7 @@ "check-types": "tsc", "lint": "eslint --color --ext .ts src/ test/", "lint:fix": "yarn run lint --fix", - "test:unit": "vitest --run --dir test/unit/ --coverage", + "test:unit": "vitest --run --dir test/unit/", "check-readme": "typescript-docs-verifier" }, "types": "lib/index.d.ts", diff --git a/packages/state-transition/vitest.config.ts b/packages/state-transition/vitest.config.ts index 1df0de848936..7a6069341168 100644 --- a/packages/state-transition/vitest.config.ts +++ b/packages/state-transition/vitest.config.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import vitestConfig from "../../vitest.base.config"; +import vitestConfig from "../../vitest.base.unit.config"; export default mergeConfig( vitestConfig, diff --git a/packages/types/package.json b/packages/types/package.json index 9d8859ecaf05..ddd2f87f48c7 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -61,9 +61,9 @@ "check-types": "tsc", "lint": "eslint --color --ext .ts src/ test/", "lint:fix": "yarn run lint --fix", - "test:constants:minimal": "LODESTAR_PRESET=minimal vitest --run --dir test/constants/ --coverage", - "test:constants:mainnet": "LODESTAR_PRESET=mainnet vitest --run --dir test/constants/ --coverage", - "test:unit": "wrapper() { yarn test:constants:minimal $@ && yarn test:constants:mainnet $@ && vitest --run --dir test/unit/ --coverage $@; }; wrapper", + "test:constants:minimal": "LODESTAR_PRESET=minimal vitest --run --dir test/constants/", + "test:constants:mainnet": "LODESTAR_PRESET=mainnet vitest --run --dir test/constants/ --coverage.enabled=false", + "test:unit": "wrapper() { yarn test:constants:minimal $@ && yarn test:constants:mainnet $@ && vitest --run --dir test/unit/ $@; }; wrapper", "test:browsers": "yarn test:browsers:chrome && yarn test:browsers:firefox && yarn test:browsers:electron", "test:browsers:chrome": "vitest --run --browser chrome --config ./vitest.browser.config.ts --dir test/unit", "test:browsers:firefox": "vitest --run --browser firefox --config ./vitest.browser.config.ts --dir test/unit", diff --git a/packages/types/vitest.config.ts b/packages/types/vitest.config.ts index 1df0de848936..7a6069341168 100644 --- a/packages/types/vitest.config.ts +++ b/packages/types/vitest.config.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import vitestConfig from "../../vitest.base.config"; +import vitestConfig from "../../vitest.base.unit.config"; export default mergeConfig( vitestConfig, diff --git a/packages/utils/package.json b/packages/utils/package.json index 9f526582483e..fcc0f5ac36c1 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -31,7 +31,7 @@ "lint": "eslint --color --ext .ts src/ test/", "lint:fix": "yarn run lint --fix", "pretest": "yarn run check-types", - "test:unit": "vitest --run --dir test/unit/ --coverage", + "test:unit": "vitest --run --dir test/unit", "test:browsers": "yarn test:browsers:chrome && yarn test:browsers:firefox && yarn test:browsers:electron", "test:browsers:chrome": "vitest --run --browser chrome --config ./vitest.browser.config.ts --dir test/unit", "test:browsers:firefox": "vitest --run --browser firefox --config ./vitest.browser.config.ts --dir test/unit", diff --git a/packages/utils/vitest.config.ts b/packages/utils/vitest.config.ts index 1df0de848936..7a6069341168 100644 --- a/packages/utils/vitest.config.ts +++ b/packages/utils/vitest.config.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import vitestConfig from "../../vitest.base.config"; +import vitestConfig from "../../vitest.base.unit.config"; export default mergeConfig( vitestConfig, diff --git a/packages/validator/package.json b/packages/validator/package.json index 14ee1002b214..92c3e92d04a1 100644 --- a/packages/validator/package.json +++ b/packages/validator/package.json @@ -28,10 +28,10 @@ "lint": "eslint --color --ext .ts src/ test/", "lint:fix": "yarn run lint --fix", "pretest": "yarn run check-types", - "test:unit": "vitest --run --dir test/unit --coverage", + "test:unit": "vitest --run --dir test/unit/", "test": "yarn test:unit", "test:spec": "vitest --run --config vitest.config.spec.ts --dir test/spec/", - "test:e2e": "LODESTAR_PRESET=mainnet vitest --run --poolOptions.threads.singleThread true --dir test/e2e", + "test:e2e": "LODESTAR_PRESET=mainnet vitest --run --config vitest.config.e2e.ts --dir test/e2e", "download-spec-tests": "node --loader=ts-node/esm test/spec/downloadTests.ts", "coverage": "codecov -F lodestar-validator", "check-readme": "typescript-docs-verifier" diff --git a/packages/validator/vitest.config.e2e.ts b/packages/validator/vitest.config.e2e.ts new file mode 100644 index 000000000000..b9f913705ef2 --- /dev/null +++ b/packages/validator/vitest.config.e2e.ts @@ -0,0 +1,11 @@ +import {defineConfig, mergeConfig} from "vitest/config"; +import vitestConfig from "../../vitest.base.e2e.config"; + +export default mergeConfig( + vitestConfig, + defineConfig({ + test: { + globalSetup: ["./test/globalSetup.ts"], + }, + }) +); diff --git a/packages/validator/vitest.config.spec.ts b/packages/validator/vitest.config.spec.ts index e5f588d17155..a207c8e29675 100644 --- a/packages/validator/vitest.config.spec.ts +++ b/packages/validator/vitest.config.spec.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import vitestConfig from "../../vitest.base.config"; +import vitestConfig from "../../vitest.base.unit.config"; export default mergeConfig( vitestConfig, diff --git a/packages/validator/vitest.config.ts b/packages/validator/vitest.config.ts index 1df0de848936..7a6069341168 100644 --- a/packages/validator/vitest.config.ts +++ b/packages/validator/vitest.config.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import vitestConfig from "../../vitest.base.config"; +import vitestConfig from "../../vitest.base.unit.config"; export default mergeConfig( vitestConfig, diff --git a/vitest.base.e2e.config.ts b/vitest.base.e2e.config.ts new file mode 100644 index 000000000000..b8b19c124bad --- /dev/null +++ b/vitest.base.e2e.config.ts @@ -0,0 +1,19 @@ +import {defineConfig, mergeConfig} from "vitest/config"; +import vitestConfig from "./vitest.base.unit.config.js"; + +export default mergeConfig( + vitestConfig, + defineConfig({ + test: { + coverage: { + enabled: false, + }, + pool: "forks", + poolOptions: { + forks: { + singleFork: true, + }, + }, + }, + }) +); diff --git a/vitest.base.spec.config.ts b/vitest.base.spec.config.ts new file mode 100644 index 000000000000..72125edcfa81 --- /dev/null +++ b/vitest.base.spec.config.ts @@ -0,0 +1,22 @@ +import {defineConfig, mergeConfig} from "vitest/config"; +import vitestConfig from "./vitest.base.unit.config.js"; + +export default mergeConfig( + vitestConfig, + defineConfig({ + test: { + coverage: { + enabled: false, + }, + testTimeout: 60_000, + hookTimeout: 60_000, + passWithNoTests: true, + pool: "threads", + poolOptions: { + threads: { + isolate: false, + }, + }, + }, + }) +); diff --git a/vitest.base.config.ts b/vitest.base.unit.config.ts similarity index 96% rename from vitest.base.config.ts rename to vitest.base.unit.config.ts index 2c12cbf41b9b..b087466fec12 100644 --- a/vitest.base.config.ts +++ b/vitest.base.unit.config.ts @@ -17,6 +17,7 @@ export default defineConfig({ setupFiles: [path.join(__dirname, "./scripts/vitest/customMatchers.ts")], reporters: ["default", "hanging-process"], coverage: { + enabled: process.env.CI === "true", clean: true, all: false, extension: [".ts"],