Skip to content

Commit aadd017

Browse files
nflaigg11tech
authored andcommitted
test: only skip ssz_static tests associated to missing type (ChainSafe#6798)
* test: only skip ssz_static tests associated to missing type * More detailed error message if type is not defined
1 parent 65627c1 commit aadd017

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

packages/beacon-node/test/spec/presets/ssz_static.test.ts

+19-16
Original file line numberDiff line numberDiff line change
@@ -57,25 +57,28 @@ const sszStatic =
5757
(ssz.altair as Types)[typeName] ||
5858
(ssz.phase0 as Types)[typeName];
5959

60+
it(`${fork} - ${typeName} type exists`, function () {
61+
expect(sszType).toEqualWithMessage(expect.any(Type), `SSZ type ${typeName} for fork ${fork} is not defined`);
62+
});
63+
6064
if (!sszType) {
61-
expect.fail(
62-
`Missing SSZ type definition for ${typeName}; this will prevent associated ssz_static tests to be executed`
63-
);
64-
} else {
65-
const sszTypeNoUint = replaceUintTypeWithUintBigintType(sszType);
65+
// Return instead of throwing an error to only skip ssz_static tests associated to missing type
66+
return;
67+
}
68+
69+
const sszTypeNoUint = replaceUintTypeWithUintBigintType(sszType);
6670

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

75-
const testData = parseSszStaticTestcase(path.join(testSuiteDirpath, testCase));
76-
runValidSszTest(sszTypeNoUint, testData);
77-
});
78-
}
79+
const testData = parseSszStaticTestcase(path.join(testSuiteDirpath, testCase));
80+
runValidSszTest(sszTypeNoUint, testData);
81+
});
7982
}
8083
};
8184

0 commit comments

Comments
 (0)