Skip to content

Commit

Permalink
Fix the test path
Browse files Browse the repository at this point in the history
  • Loading branch information
nazarhussain committed Oct 9, 2023
1 parent 48af4c2 commit 42725aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
4 changes: 2 additions & 2 deletions packages/beacon-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 'test/unit/**/*.test.ts'",
"test:unit:minimal": "vitest --run --dir test/unit/",
"test:unit:mainnet": "LODESTAR_PRESET=mainnet nyc --cache-dir .nyc_output/.cache -e .ts mocha 'test/unit-mainnet/**/*.test.ts'",
"test:unit": "yarn test:unit:minimal && yarn test:unit:mainnet",
"test:e2e": "LODESTAR_PRESET=minimal yarn vitest --run test/e2e/",
"test:e2e": "LODESTAR_PRESET=minimal vitest --run --single-thread --dir test/e2e",
"test:sim": "mocha 'test/sim/**/*.test.ts'",
"test:sim:merge-interop": "mocha 'test/sim/merge-interop.test.ts'",
"test:sim:mergemock": "mocha 'test/sim/mergemock.test.ts'",
Expand Down
19 changes: 5 additions & 14 deletions packages/beacon-node/test/e2e/api/lodestar/lodestar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import {LogLevel, testLogger, TestLoggerOpts} from "../../../utils/logger.js";
import {getDevBeaconNode} from "../../../utils/node/beacon.js";
import {waitForEvent} from "../../../utils/events/resolver.js";
import {ClockEvent} from "../../../../src/util/clock.js";
import {BeaconNode} from "../../../../src/index.js";

describe("api / impl / validator", function () {
describe("getLiveness endpoint", function () {
let bn: BeaconNode | undefined;
const SECONDS_PER_SLOT = 2;
const ALTAIR_FORK_EPOCH = 0;
const validatorCount = 8;
Expand All @@ -23,13 +25,8 @@ describe("api / impl / validator", function () {
const genesisSlotsDelay = 5;
const timeout = (SLOTS_PER_EPOCH + genesisSlotsDelay) * testParams.SECONDS_PER_SLOT * 1000;

const afterEachCallbacks: (() => Promise<unknown> | void)[] = [];

afterEach(async () => {
while (afterEachCallbacks.length > 0) {
const callback = afterEachCallbacks.pop();
if (callback) await callback();
}
if (bn) await bn.close();
});

it("Should return validator indices that are live", async function () {
Expand All @@ -39,7 +36,7 @@ describe("api / impl / validator", function () {

const loggerNodeA = testLogger("Node-A");

const bn = await getDevBeaconNode({
bn = await getDevBeaconNode({
params: testParams,
options: {
sync: {isSingleNode: true},
Expand All @@ -49,9 +46,6 @@ describe("api / impl / validator", function () {
validatorCount,
logger: loggerNodeA,
});
afterEachCallbacks.push(async () => {
await bn.close();
});

// live indices at epoch of consideration, epoch 0
bn.chain.seenBlockProposers.add(0, 1);
Expand Down Expand Up @@ -90,7 +84,7 @@ describe("api / impl / validator", function () {
const testLoggerOpts: TestLoggerOpts = {level: LogLevel.info};
const loggerNodeA = testLogger("Node-A", testLoggerOpts);

const bn = await getDevBeaconNode({
bn = await getDevBeaconNode({
params: testParams,
options: {
sync: {isSingleNode: true},
Expand All @@ -100,9 +94,6 @@ describe("api / impl / validator", function () {
validatorCount,
logger: loggerNodeA,
});
afterEachCallbacks.push(async () => {
await bn.close();
});

await waitForEvent<phase0.Checkpoint>(bn.chain.clock, ClockEvent.epoch, timeout); // wait for epoch 1
await waitForEvent<phase0.Checkpoint>(bn.chain.clock, ClockEvent.epoch, timeout); // wait for epoch 2
Expand Down

0 comments on commit 42725aa

Please sign in to comment.