mirror of
https://github.com/ChainSafe/lodestar.git
synced 2026-01-08 23:28:10 -05:00
test: update to vitest 4 to use builtin bun support (#8599)
**Motivation** Update the vitest to avoid using third party test pool. **Description** - Use latest vitest - Remove custom process pool which we developed to run our tests in Bun runtime - Migrate test configs to latest version - Update types - Switch to playwright from webdriverio for browser tests performance, which was due for long. **Steps to test or reproduce** - Run all tests
This commit is contained in:
@@ -1,24 +1,23 @@
|
||||
import path from "node:path";
|
||||
import {ViteUserConfig, defineConfig} from "vitest/config";
|
||||
import {TestUserConfig, defineConfig} from "vitest/config";
|
||||
import {browserTestProject} from "./configs/vitest.config.browser.js";
|
||||
import {e2eMainnetProject, e2eMinimalProject} from "./configs/vitest.config.e2e.js";
|
||||
import {specProjectMainnet, specProjectMinimal} from "./configs/vitest.config.spec.js";
|
||||
import {typesTestProject} from "./configs/vitest.config.types.js";
|
||||
import {unitTestMainnetProject, unitTestMinimalProject} from "./configs/vitest.config.unit.js";
|
||||
import {esmCjsInteropPlugin} from "./scripts/vite/plugins/esmCjsInteropPlugin.js";
|
||||
|
||||
const isBun = "bun" in process.versions;
|
||||
|
||||
export function getReporters(): ViteUserConfig["test"]["reporters"] {
|
||||
if (isBun) return [["default", {summary: false}]];
|
||||
if (process.env.GITHUB_ACTIONS) return ["verbose", "hanging-process", "github-actions"];
|
||||
export function getReporters(): TestUserConfig["reporters"] {
|
||||
if (process.env.GITHUB_ACTIONS) return ["tree", "hanging-process", "github-actions"];
|
||||
if (process.env.TEST_COMPACT_OUTPUT) return ["basic", "hanging-process"];
|
||||
|
||||
return ["verbose", "hanging-process"];
|
||||
return ["tree", "hanging-process"];
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [esmCjsInteropPlugin()],
|
||||
test: {
|
||||
workspace: [
|
||||
projects: [
|
||||
{
|
||||
extends: true,
|
||||
...unitTestMinimalProject,
|
||||
@@ -77,9 +76,8 @@ export default defineConfig({
|
||||
onConsoleLog: () => !process.env.TEST_QUIET_CONSOLE,
|
||||
coverage: {
|
||||
enabled: false,
|
||||
include: ["packages/**/src/**.{ts}"],
|
||||
clean: true,
|
||||
all: false,
|
||||
extension: [".ts"],
|
||||
provider: "v8",
|
||||
reporter: [["lcovonly", {file: "lcov.info"}], ["text"]],
|
||||
reportsDirectory: "./coverage",
|
||||
|
||||
Reference in New Issue
Block a user