Skip to content

Commit

Permalink
test: only skip ssz_static tests associated to missing type (#6798)
Browse files Browse the repository at this point in the history
* test: only skip ssz_static tests associated to missing type

* More detailed error message if type is not defined
  • Loading branch information
nflaig authored and g11tech committed May 24, 2024
1 parent d029cf7 commit 0aa0a4d
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions packages/beacon-node/test/spec/presets/ssz_static.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,28 @@ const sszStatic =
(ssz.altair as Types)[typeName] ||
(ssz.phase0 as Types)[typeName];

it(`${fork} - ${typeName} type exists`, function () {
expect(sszType).toEqualWithMessage(expect.any(Type), `SSZ type ${typeName} for fork ${fork} is not defined`);
});

if (!sszType) {
expect.fail(
`Missing SSZ type definition for ${typeName}; this will prevent associated ssz_static tests to be executed`
);
} else {
const sszTypeNoUint = replaceUintTypeWithUintBigintType(sszType);
// Return instead of throwing an error to only skip ssz_static tests associated to missing type
return;
}

const sszTypeNoUint = replaceUintTypeWithUintBigintType(sszType);

for (const testCase of fs.readdirSync(testSuiteDirpath)) {
// Do not manually skip tests here, do it in packages/beacon-node/test/spec/presets/index.test.ts
it(testCase, function () {
// Mainnet must deal with big full states and hash each one multiple times
if (ACTIVE_PRESET === "mainnet") {
vi.setConfig({testTimeout: 30 * 1000});
}
for (const testCase of fs.readdirSync(testSuiteDirpath)) {
// Do not manually skip tests here, do it in packages/beacon-node/test/spec/presets/index.test.ts
it(testCase, function () {
// Mainnet must deal with big full states and hash each one multiple times
if (ACTIVE_PRESET === "mainnet") {
vi.setConfig({testTimeout: 30 * 1000});
}

const testData = parseSszStaticTestcase(path.join(testSuiteDirpath, testCase));
runValidSszTest(sszTypeNoUint, testData);
});
}
const testData = parseSszStaticTestcase(path.join(testSuiteDirpath, testCase));
runValidSszTest(sszTypeNoUint, testData);
});
}
};

Expand Down

0 comments on commit 0aa0a4d

Please sign in to comment.