Skip to content

Commit

Permalink
improve expectRevert output
Browse files Browse the repository at this point in the history
  • Loading branch information
dotrungkien committed Jun 26, 2019
1 parent a4789e0 commit ec36a94
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/expectRevert.js
Expand Up @@ -2,13 +2,15 @@ const { web3 } = require('./setup');

const colors = require('ansi-colors');
const semver = require('semver');
const assert = require('assert')

async function expectException (promise, expectedError) {
try {
await promise;
} catch (error) {
if (error.message.indexOf(expectedError) === -1) {
throw Error(`Wrong failure type, expected '${expectedError}' and got '${error.message}'`);
const actualError = error.message.replace('Returned error: VM Exception while processing transaction: ', '');
assert.fail(`Wrong failure type, expected '${expectedError}' and got '${actualError}'`);
}
return;
}
Expand Down

0 comments on commit ec36a94

Please sign in to comment.