[英]Mocha Does Not Run Second describe()
I am writing a test coverage for my code base and just started using Mocha/Chai for my backend.我正在为我的代码库编写测试覆盖率,并且刚刚开始使用 Mocha/Chai 作为我的后端。 For whatever reason I can't get my second describe() to run in this function.
无论出于何种原因,我都无法让我的第二个 describe() 在这个 function 中运行。 I don't receive any error, it just exits after running the first describe() suite.
我没有收到任何错误,它只是在运行第一个 describe() 套件后退出。
export async function testCreateUnknownCustomer(billCodeTest) {
let unknownRecordTest;
describe("Create A Unknown Customer Record", function () {
it("Creates a new unknown customer", async function () {
unknownRecordTest = await CustomersController.createUnknownCustomer(
'+15555551111',
billCodeTest
)
})
it('Should Be a Instance of a Sequelize Model', function () {
expect(unknownRecordTest instanceof Model).equals(true);
})
});
describe("Hard Delete unknown customer record", function () {
const unknownID = unknownRecordTest.customer_id;
it("Deletes a customer record", async function () {
console.log(await unknownRecordTest.destroy());
console.log(unknownRecordTest);
})
});
}
Leaving the describes
raw in the file seems to have fixed everything.在文件中保留原始
describes
似乎已经解决了所有问题。 As opposed to wrapping it in a function that is exported and run in a main.test.js
execution file.与将其包装在导出并在
main.test.js
执行文件中运行的 function 中相反。 I don't really have a technical explanation why secondary describes wouldn't have executed regardless.我真的没有技术解释为什么辅助描述无论如何都不会执行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.