[英]Node JS Mocha Test Cases Not running
我正在嘗試建立一個包含測試用例的測試套件。 出於某種原因,我們無法進行解雇,因此我使測試用例盡可能簡單。 除了前面描述的內容以外,debug.log仍然沒有打印出來。 幾乎就像代碼看不到我的任何摩卡測試一樣。 我在本地安裝了mocha作為dev依賴項。 即使我的代碼中沒有這么多的測試用例,它也會返回許多通過的測試用例。 我嘗試卸載並重新安裝摩卡。
終端返回** / test / runner.js輸入Org Runner Config設置數據庫信息:mongodb:// xxxxx:xxxxxxxx @ localhost / icpDB
657個測試。 0個失敗。 268毫秒
流程結束,退出代碼為0
const mocha = require('mocha');
const chai = require('chai');
const debug = require('debug');
debug.log('Entered Org Runner');
describe('Org api test suite', function () {
before(function (done) {
debug.log('Entered Org Before');
done();
});
after(function (done) {
debug.log('Entered Org After');
done();
});
it('should create a new org', function (done) {
debug.log('Entered Create Org It');
done();
});
describe('GET Orgs', function () {
it('should respond with an array of orgs', function (done) {
debug.log('Entered Get Orgs It');
done();
});
});
describe('GET Org', function () {
it('should get a org by id', function (done) {
debug.log('It: should get a org by id');
done();
});
it('should throw an error for invalid id', function (done) {
debug.log('It: should throw an error for invalid id');
done();
});
});
describe('Update Org', function () {
it('should update an existing org', function (done) {
debug.log('should update an existing org');
done();
});
});
describe('Delete Org', function () {
it('should delete an existing org', function (done) {
debug.log('should delete an existing org');
done();
});
});
});
原來問題出在我的package.json中使用了--recursive。 測試案例之一是導致摩卡退出。 當我直接將其指向上面的特定文件時,它會按預期執行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.