Skip to content
This repository was archived by the owner on Jun 14, 2018. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/testing/soliditytest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down