Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configs/vite.config.base.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {visualizer} from "rollup-plugin-visualizer";
import {UserConfig, defineConfig} from "vite";
import {defineConfig} from "vite";
import {nodePolyfills} from "vite-plugin-node-polyfills";
import topLevelAwait from "vite-plugin-top-level-await";
import {blsBrowserPlugin} from "../scripts/vite/plugins/blsBrowserPlugin.js";
Expand Down
14 changes: 4 additions & 10 deletions configs/vitest.config.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ export const e2eMinimalProject = defineProject({
LODESTAR_PRESET: "minimal",
},
pool: "forks",
poolOptions: {
forks: {
singleFork: true,
},
},
maxWorkers: 1,
isolate: false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This combination will replace singleFork: true in from older version

sequence: {
concurrent: false,
shuffle: false,
Expand All @@ -43,11 +40,8 @@ export const e2eMainnetProject = defineProject({
LODESTAR_PRESET: "mainnet",
},
pool: "forks",
poolOptions: {
forks: {
singleFork: true,
},
},
maxWorkers: 1,
isolate: false,
sequence: {
concurrent: false,
shuffle: false,
Expand Down
16 changes: 2 additions & 14 deletions configs/vitest.config.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,12 @@ const setupFiles = [
path.join(import.meta.dirname, "../scripts/vitest/setupFiles/lodestarPreset.ts"),
];

const isBun = "bun" in process.versions;

export const unitTestMinimalProject = defineProject({
test: {
name: "unit-minimal",
include: ["**/test/unit-minimal/**/*.test.ts"],
setupFiles,
// Current vitest `forks` pool is not yet supported with Bun
// so we conditionally switch to our custom pool which run tests in main process
pool: isBun ? "vitest-in-process-pool" : "forks",
poolOptions: {
forks: isBun ? {singleFork: true} : {},
},
pool: "forks",
env: {
LODESTAR_PRESET: "minimal",
},
Expand All @@ -39,12 +32,7 @@ export const unitTestMainnetProject = defineProject({
// for now I tried to identify such tests an increase the limit a bit higher
testTimeout: 20_000,
hookTimeout: 20_000,
// Current vitest `forks` pool is not yet supported with Bun
// so we conditionally switch to our custom pool which run tests in main process
pool: isBun ? "vitest-in-process-pool" : "forks",
poolOptions: {
forks: isBun ? {singleFork: true} : {},
},
pool: "forks",
env: {
LODESTAR_PRESET: "mainnet",
},
Expand Down
18 changes: 8 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
"@chainsafe/biomejs-config": "^1.0.0",
"@types/node": "^22.18.6",
"@types/react": "^19.1.12",
"@vitest/browser": "3.0.9",
"@vitest/coverage-v8": "3.0.9",
"@vitest/browser": "^4.0.6",
"@vitest/coverage-v8": "^4.0.6",
"bun-types": "^1.2.21",
"crypto-browserify": "^3.12.0",
"dotenv": "^16.4.5",
Expand All @@ -70,20 +70,18 @@
"typescript": "^5.9.2",
"typescript-docs-verifier": "^3.0.1",
"vite": "^6.0.11",
"vite-plugin-dts": "^4.5.0",
"vite-plugin-node-polyfills": "^0.23.0",
"vite-plugin-top-level-await": "^1.5.0",
"vitest": "3.0.9",
"vitest-in-process-pool": "2.0.1",
"vitest-when": "^0.6.1",
"vite-plugin-dts": "^4.5.4",
"vite-plugin-node-polyfills": "^0.24.0",
"vite-plugin-top-level-await": "^1.6.0",
"vitest": "^4.0.6",
"vitest-when": "^0.9.0",
"wait-port": "^1.1.0",
"webdriverio": "^9.7.2"
"webdriverio": "^9.20.0"
},
"resolutions": {
"dns-over-http-resolver": "^2.1.1",
"loupe": "^2.3.6",
"testcontainers/**/nan": "^2.19.0",
"vitest": "3.0.9",
"elliptic": ">=6.6.1"
}
}
3 changes: 2 additions & 1 deletion packages/beacon-node/test/mocks/mockedBeaconChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map";
import {ChainForkConfig} from "@lodestar/config";
import {config as defaultConfig} from "@lodestar/config/default";
import {EpochDifference, ForkChoice, ProtoBlock} from "@lodestar/fork-choice";
import {CachedBeaconStateAllForks} from "@lodestar/state-transition";
import {Logger} from "@lodestar/utils";
import {BeaconProposerCache} from "../../src/chain/beaconProposerCache.js";
import {BeaconChain} from "../../src/chain/chain.js";
Expand All @@ -20,7 +21,7 @@ import {getMockedLogger} from "./loggerMock.js";

export type MockedBeaconChain = Mocked<BeaconChain> & {
logger: Mocked<Logger>;
getHeadState: Mock;
getHeadState: Mocked<CachedBeaconStateAllForks>;
forkChoice: MockedForkChoice;
executionEngine: Mocked<ExecutionEngineHttp>;
executionBuilder: Mocked<ExecutionBuilderHttp>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe("validate voluntary exit", () => {
vi.spyOn(chainStub, "getHeadStateAtCurrentEpoch").mockResolvedValue(state);
vi.spyOn(opPool, "hasSeenBlsToExecutionChange");
vi.spyOn(opPool, "hasSeenVoluntaryExit");
vi.spyOn(chainStub.bls, "verifySignatureSets").mockResolvedValue(true);
chainStub.bls.verifySignatureSets.mockResolvedValue(true);
});

afterEach(() => {
Expand Down Expand Up @@ -165,7 +165,7 @@ describe("validate voluntary exit", () => {

opPool.hasSeenVoluntaryExit.mockReturnValue(false);

vi.spyOn(chainStub.bls, "verifySignatureSets").mockResolvedValue(false);
chainStub.bls.verifySignatureSets.mockResolvedValue(false);

await expectRejectedWithLodestarError(
validateGossipVoluntaryExit(chainStub, signedVoluntaryExitInvalidSig),
Expand Down
5 changes: 3 additions & 2 deletions packages/beacon-node/test/unit/sync/unknownBlock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import {getRandPeerIdStr, getRandPeerSyncMeta} from "../../utils/peer.js";

describe.skip(
"sync by UnknownBlockSync",
// spacer comment to avoid unnecessary changes in git
{timeout: 20_000},
() => {
const logger = testLogger();
const slotSec = 0.3;
Expand Down Expand Up @@ -258,8 +260,7 @@ describe.skip(
syncService.close();
});
}
},
{timeout: 20_000}
}
);

describe("UnknownBlockSync", () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/spec-test-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
"@lodestar/utils": "^1.35.0",
"rimraf": "^4.4.1",
"snappyjs": "^0.7.0",
"vitest": "3.0.9"
"vitest": "^4.0.6"
},
"peerDependencies": {
"vitest": "3.0.9"
"vitest": "^4.0.6"
}
}
4 changes: 2 additions & 2 deletions packages/test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@
"axios": "^1.3.4",
"testcontainers": "^10.2.1",
"tmp": "^0.2.1",
"vitest": "3.0.9"
"vitest": "^4.0.6"
},
"devDependencies": {
"@types/yargs": "^17.0.24"
},
"peerDependencies": {
"vitest": "3.0.9"
"vitest": "^4.0.6"
}
}
12 changes: 4 additions & 8 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
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";

const isBun = "bun" in process.versions;

export function getReporters(): ViteUserConfig["test"]["reporters"] {
if (isBun) return [["default", {summary: false}]];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was hack to for older process pool, not needed now.

export function getReporters(): TestUserConfig["reporters"] {
if (process.env.GITHUB_ACTIONS) return ["verbose", "hanging-process", "github-actions"];
if (process.env.TEST_COMPACT_OUTPUT) return ["basic", "hanging-process"];

Expand All @@ -18,7 +15,7 @@ export function getReporters(): ViteUserConfig["test"]["reporters"] {

export default defineConfig({
test: {
workspace: [
projects: [
{
extends: true,
...unitTestMinimalProject,
Expand Down Expand Up @@ -77,9 +74,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",
Expand Down
Loading
Loading