I am using standardJS for testing my code. Also I am using mocha chai. With that I'm getting the error expect an assignment or function call and instead saw an expression.
for this line:
expect(err).to.be.null
But this line is correct, so what am I doing wrong?
Here are two possible solutions:
1. Use dirty-chai
Using dirty-chai
you can change this:
expect(err).to.be.null
to this:
expect(err).to.be.null()
Use it like this:
var chai = require('chai');
var dirtyChai = require('dirty-chai');
var expect = chai.expect
chai.use(dirtyChai);
expect(err).to.be.null()
2. Disable the rule by adding a comment to the top of each test file
/* eslint-disable no-unused-expressions */
Note: Please read this comment for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With