diff --git a/lib/testing/soliditytest.js b/lib/testing/soliditytest.js index ca40847..322e92a 100644 --- a/lib/testing/soliditytest.js +++ b/lib/testing/soliditytest.js @@ -7,6 +7,8 @@ var artifactor = require("truffle-artifactor"); var contract = require("truffle-contract"); var series = require("async").series; var path = require("path"); +var Web3 = require("web3"); +var web3 = new Web3(); var SolidityTest = { define: function(abstraction, dependency_paths, runner, mocha) { @@ -30,6 +32,12 @@ var SolidityTest = { // Function that checks transaction logs to see if a test failed. function processResult(result) { + if (result.receipt.status != null) { + // note: testrpc is numeric, geth is hex + if (web3.toBigNumber(result.receipt.status).toNumber() != 1) { + throw new Error("transaction revert"); + } + } result.logs.forEach(function(log) { if (log.event == "TestEvent" && log.args.result == false) { throw new Error(log.args.message);