为什么运行此测试文件时会收到TypeError: expect is not a function
?
我已经在本地安装了mocha和chai,并通过yarn run test
(仅运行"test": "mocha"
)运行测试。
var chai = require('chai')
var expect = chai.expect()
describe('Array', function () {
describe('#indexOf()', function () {
it('should return -1 when the value is not present', function () {
expect([1, 2, 3].indexOf(4)).to.be.equal(-1)
})
})
})
最佳答案
关于javascript - TypeError:Expect不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47032542/