[SOLVED] Mocha Does Not Run Second describe()


This Content is from Stack Overflow. Question asked by jps_dot_dev

I am writing a test coverage for my code base and just started using Mocha/Chai for my backend. For whatever reason I can’t get my second describe() to run in this function. I don’t receive any error, it just exits after running the first describe() suite.

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(
    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());


Leaving the describes raw in the file seems to have fixed everything. As opposed to wrapping it in a function that is exported and run in a main.test.js execution file. I don’t really have a technical explanation why secondary describes wouldn’t have executed regardless.

This Question was asked in StackOverflow by jps_dot_dev and Answered by jps_dot_dev It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?