Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ internals.equal = function (value, options) {
const compare = this._flags.shallow ? (a, b) => a === b
: (a, b) => Hoek.deepEqual(a, b, settings);

return this.assert(compare(this._ref, value), 'equal specified value', this._ref, value);
return this.assert(compare(this._ref, value), `equal specified value: ${NodeUtil.inspect(value)}`, this._ref, value);
};

internals.addMethod(['equal', 'equals'], internals.equal);
Expand Down
20 changes: 17 additions & 3 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ describe('expect()', () => {
}

Code.settings.comparePrototypes = origPrototype;
Hoek.assert(exception.message === 'Expected {} to equal specified value', exception);
Hoek.assert(exception.message === 'Expected {} to equal specified value: {}', exception);
done();
});

Expand Down Expand Up @@ -1573,7 +1573,7 @@ describe('expect()', () => {
exception = err;
}

Hoek.assert(exception.message === 'Expected { foo: 1 } to equal specified value', exception);
Hoek.assert(exception.message === 'Expected { foo: 1 } to equal specified value: { foo: 2 }', exception);
done();
});

Expand Down Expand Up @@ -1605,7 +1605,21 @@ describe('expect()', () => {
exception = err;
}

Hoek.assert(exception.message === 'Expected [ \'a\' ] to equal specified value', exception);
Hoek.assert(exception.message === 'Expected [ \'a\' ] to equal specified value: [ \'a\' ]', exception);
done();
});

it('prints the specified value', (done) => {

let exception = false;
try {
Code.expect('test').to.equal('junk');
}
catch (err) {
exception = err;
}

Hoek.assert(exception.message === 'Expected \'test\' to equal specified value: \'junk\'', exception);
done();
});
});
Expand Down