2
1) test_initial_badge_creation
    > No events were emitted


  2 passing (2s)
  1 failing


/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/reporters/base.js:178
  failures.forEach(function (test, i) {
           ^
TypeError: test.titlePath is not a function
    at /usr/local/lib/node_modules/truffle/node_modules/mocha/lib/reporters/base.js:230:10
    at Array.forEach (<anonymous>)
    at Function.exports.list (/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/reporters/base.js:178:12)
    at Spec.Base.epilogue (/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/reporters/base.js:350:10)
    at Runner.emit (events.js:185:15)
    at /usr/local/lib/node_modules/truffle/node_modules/mocha/lib/runner.js:829:12
    at /usr/local/lib/node_modules/truffle/node_modules/mocha/lib/runner.js:677:9
    at next (/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/runner.js:290:14)
    at Immediate.<anonymous> (/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/runner.js:334:5)
    at runCallback (timers.js:763:18)
    at tryOnImmediate (timers.js:734:5)
    at processImmediate (timers.js:716:5)

Can somebody explain how the test can fail without emitting an event even tho I have an Assert phrase in it?

function test_initial_creation() public{
    A a = A(DeployedAddresses.A());
    B b = B(DeployedAddresses.B());

    a.init(address(b));

    address[] memory adr;
    uint[] memory price;
    (adr, price) = a.getInfo();

    Assert.equal(adr.length, 6, "Initial Info length should be 6");
}

Shouldn't it pass or fail with an emitted event? Also what is the error message from Mocha below?

  • Can you post the test code? – mirg May 30 '18 at 13:19
  • @mirg Sure. Updated with test code – Senju May 31 '18 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.