You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var chai = require('chai');
require('chai-things');
chai.should();
var numArray = [1,2,3,4,9882];
describe('array', function () {
describe('elements', function () {
it('should all be numbers', function () {
return numArray.should.all.be.a('number');
});
});
describe('first element', function () {
it('should be a number', function () {
return numArray[3].should.be.a('number');
});
});
});
Mocha run results:
array
elements
1) should all be numbers
first element
✓ should be a number
1 passing (9ms)
1 failing
1) array elements should all be numbers:
AssertionError: expected [ 1, 2, 3, 4, 9882 ] to be a number
The text was updated successfully, but these errors were encountered:
That works, because the test is executed on the array, not on the elements, and (the stringified version of) the array coincidentally also matches /.*/. It would not work with /^\d+$/.
Sorry about the issue#10, accidentally closed it!
Mocha run results:
The text was updated successfully, but these errors were encountered: