我正在制作摩卡测试用例。但是当我运行我的文件给错误。这是我的错误。 TypeError:无法设置未定义的属性“文件”
这是我的代码
const describe = require('mocha');
const assert = require('assert');
describe('Array', () => {
describe('#indexOf()', () => {
it('should return -1 when the value is not present', () => {
// assert.equal([1, 2, 3].indexOf(4), -1);
assert.equal([1, 2, 3].indexOf(4), -1);
});
});
});
这是错误
E:\Node\Angular-node-mysql\server\node_modules\mocha\lib\mocha.js:85
this.files = [];
^
TypeError: Cannot set property 'files' of undefined
at Mocha (E:\Node\Angular-node-mysql\server\node_modules\mocha\lib\mocha.js:85:14)
at Object.<anonymous> (E:\Node\Angular-node-mysql\server\routes\userRoute\user.spec.js:5:1)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3