mirror of
https://github.com/ChainSafe/lodestar.git
synced 2026-01-08 23:28:10 -05:00
test: setup unit tests for bun runtime (#7971)
**Motivation** Make our codebase compatible with Bun runtime **Description** - Configure Vitest to work along Bun - Add CI workflow to test Unit tests for Bun **Steps to test or reproduce** Run all tests
This commit is contained in:
@@ -1,11 +1,21 @@
|
||||
import path from "node:path";
|
||||
import {defineConfig} from "vitest/config";
|
||||
import {ViteUserConfig, 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";
|
||||
|
||||
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"];
|
||||
if (process.env.TEST_COMPACT_OUTPUT) return ["basic", "hanging-process"];
|
||||
|
||||
return ["verbose", "hanging-process"];
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
workspace: [
|
||||
@@ -60,9 +70,7 @@ export default defineConfig({
|
||||
teardownTimeout: 5_000,
|
||||
// We have a few spec tests suits (specially spec tests) which don't have individual tests
|
||||
passWithNoTests: true,
|
||||
reporters: process.env.GITHUB_ACTIONS
|
||||
? ["verbose", "hanging-process", "github-actions"]
|
||||
: [process.env.TEST_COMPACT_OUTPUT ? "basic" : "verbose", "hanging-process"],
|
||||
reporters: getReporters(),
|
||||
diff: process.env.TEST_COMPACT_DIFF
|
||||
? path.join(import.meta.dirname, "../scripts/vitest/vitest.diff.ts")
|
||||
: undefined,
|
||||
|
||||
Reference in New Issue
Block a user