做摩卡测试



晚上好,我正在学习测试并安装了mocha。我有一个基本的测试,只比较两个数字,我无法运行它。有人能向我解释一下为什么以及如何解决这个问题吗?

Json

{  "scripts": {
"test": "mocha test/**/*.js"
},
"name": "image-gallery",
"version": "1.0.0",
"description": "",
"main": "script-test.js",
"directories": {
"test": "script-test.js"
},

"author": "",
"license": "ISC"
}

测试.js

const assert = require('assert');
describe('number test', function() {
it('matching numbers', function() {
assert.ok(2 === 2);
});
});

您是否通过在项目目录中运行mocha来安装mocha?

npm install --save-dev mocha

最新更新