feature(@package/solidity-tests): update to remix-tests 0.1.24

This commit is contained in:
Iuri Matias 2020-01-14 16:27:12 -05:00
parent c395826c53
commit f0aefb3fb0
4 changed files with 194 additions and 723 deletions

View File

@ -53,7 +53,7 @@
"async": "3.1.0",
"core-js": "3.4.3",
"embark-utils": "^5.0.0",
"remix-tests": "0.1.20",
"remix-tests": "0.1.24",
"web3": "1.2.4",
"yo-yoify": "4.3.0"
},

View File

@ -81,6 +81,8 @@ class SolidityTestRunner {
const contractFiles = this.files.map(f => new File({path: f, originalPath: f, type: Types.custom, resolver: resolverFn(f)}));
contractFiles.unshift(ASSERT_LIB);
let allCompiledContracts = {};
async.waterfall([
(next) => {
// write the remix_tests file where it will be found.
@ -105,6 +107,7 @@ class SolidityTestRunner {
},
*/
(compiledContracts, next) => {
allCompiledContracts = compiledContracts;
// TODO: fetch config and use it here
events.request("contracts:build", { contracts: {} }, compiledContracts, next);
},
@ -152,7 +155,24 @@ class SolidityTestRunner {
evm: { methodIdentifiers: instance.functionHashes }
};
remixTests.runTest(contract, contractObj, details, {accounts}, reporter.report.bind(reporter), cb);
const ast = allCompiledContracts[instance.className].ast;
// TODO: temporary fix until this is fixed in remix-tests, remove this snippet when it is
/*eslint max-depth: ["error", 5]*/
if (ast.nodes && ast.nodes.length > 0) {
for (let node of ast.nodes) {
if (node.nodeType === 'ContractDefinition') {
for (let subnode of node.nodes) {
if (subnode.nodeType === 'FunctionDefinition') {
subnode.kind = 'function';
}
}
}
}
}
// TODO: temporary fix until this is fixed in remix-tests, remove this snippet when it is
remixTests.runTest(contract, contractObj, details, ast, {accounts}, reporter.report.bind(reporter), cb);
}, next);
}
], cb);

View File

@ -15,8 +15,10 @@ class Reporter {
case 'testFailure':
this.reporter.report(`${this.contract} ${payload.value}`, payload.time, false, payload.errMsg);
break;
case 'accountsList':
break;
default:
console.log('dont know how to handle');
console.log('Reporter warning: dont know how to handle the following payload');
console.dir(payload);
}
}

889
yarn.lock

File diff suppressed because it is too large Load Diff