mercredi 1 avril 2015

Mocha js tests not showing diff when strings not equal

I have a simple unit test to assert a string is correct but it only shows me the test name that failed, not the diff of expected and actual results. For example, here is some silly test code:



describe('stackoverflow', function(){
it('should be simple', function() {
var someValue = 'A' + 1 + 2;
assert.equal('A3', someValue);
});
});


The the output isn't very helpful:



$ mocha

stackoverflow
1) should be simple <--- this line is red


Yes I can see which test failed but I can't easily see why. I'd like to see something like:



$ mocha

stackoverflow
1) should be simple

Expected: 'A3'
Actual : 'A12'


Is there something I'm doing wrong?


Aucun commentaire:

Enregistrer un commentaire