UNPKG

@chainsafe/eth2.0-spec-test-util

Version:

Spec test suite generator from yaml test files

27 lines (18 loc) 2.15 kB
# eth2.0-spec-test-util Mocha / Chai utility for interacting with eth2.0 spec tests ## API <!-- Generated by documentation.js. Update this documentation by updating the source code. --> ### describeSpecTest Run yaml Eth2.0 spec tests for a certain function Compares actual vs expected for all test cases #### Parameters - `testYamlPath` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** path to yaml spec test - `testFunc` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** function to use to generate output - `getInput` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** function to convert test case into input array (optional, default `testCase=>testCase.input`) - `getExpected` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** function to convert test case into a comparable expected output (optional, default `testCase=>testCase.output`) - `getActual` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** function to convert function output into comparable actual output (optional, default `result=>result`) - `shouldError` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** function to convert test case into a boolean, if the case should result in an error (optional, default `(testCase,index,testSpec)=>false`) - `shouldSkip` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** function to convert test case into a boolean, if the case should be skipped (optional, default `(testCase,index,testSpec)=>false`) - `expectFunc` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** function to run expectations against expected and actual output (optional, default `(testCase,expect,expected,actual)=>expect(actual).to.be.equal(expected)`) ## Profiling Set env variable GEN_PROFILE_DIR with path to directory where you wish your cpu profiles to be generated.