I\'m trying to test an array such as:
let projects = [
{
\"id\": \"55a75be01fa2c7ff76a2ce7a\",
\"title: \"Only-Ben\",
\"other_keys\
The second version (with Babel) does not work because your test forgets to call chai.should()
. In my testing, once that method call is added, everything works as expected (the test passes).
It also seems that Bergi was correct in this comment.
If this does not work for you, it seems that in order to help you, we would need more information. It might help to provide the source code of the babelhook
--compilers
option you are using. (The standard way of referencing Babel from Mocha's compiler option is mocha --compilers js:babel/register
.)
Here is my test code:
import chai from 'chai';
chai.should();
import chaiThings from "chai-things";
chai.use(chaiThings);
describe('Array', function() {
it('Test array', function(cb){
[{ a: 'cat' }, { a: 'dog' }].should.include.something.that.deep.equals({ a: 'cat' })
cb();
});
});