|
1 | 1 | import fs from "node:fs";
|
2 | 2 | import path from "node:path";
|
3 |
| -import {it, vi} from "vitest"; |
| 3 | +import {expect, it, vi} from "vitest"; |
4 | 4 | import {Type} from "@chainsafe/ssz";
|
5 | 5 | import {ssz} from "@lodestar/types";
|
6 | 6 | import {ACTIVE_PRESET, ForkName, ForkLightClient, ForkExecution} from "@lodestar/params";
|
@@ -56,23 +56,26 @@ const sszStatic =
|
56 | 56 | (ssz.bellatrix as Types)[typeName] ||
|
57 | 57 | (ssz.altair as Types)[typeName] ||
|
58 | 58 | (ssz.phase0 as Types)[typeName];
|
59 |
| - if (!sszType) { |
60 |
| - throw Error(`No type for ${typeName}`); |
61 |
| - } |
62 | 59 |
|
63 |
| - const sszTypeNoUint = replaceUintTypeWithUintBigintType(sszType); |
| 60 | + 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); |
64 | 66 |
|
65 |
| - for (const testCase of fs.readdirSync(testSuiteDirpath)) { |
66 |
| - // Do not manually skip tests here, do it in packages/beacon-node/test/spec/presets/index.test.ts |
67 |
| - it(testCase, function () { |
68 |
| - // Mainnet must deal with big full states and hash each one multiple times |
69 |
| - if (ACTIVE_PRESET === "mainnet") { |
70 |
| - vi.setConfig({testTimeout: 30 * 1000}); |
71 |
| - } |
| 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 | + } |
72 | 74 |
|
73 |
| - const testData = parseSszStaticTestcase(path.join(testSuiteDirpath, testCase)); |
74 |
| - runValidSszTest(sszTypeNoUint, testData); |
75 |
| - }); |
| 75 | + const testData = parseSszStaticTestcase(path.join(testSuiteDirpath, testCase)); |
| 76 | + runValidSszTest(sszTypeNoUint, testData); |
| 77 | + }); |
| 78 | + } |
76 | 79 | }
|
77 | 80 | };
|
78 | 81 |
|
|
0 commit comments