Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can i place multiple test-suits in a single test-suit using Jest and supertest?

I have created multiple test-suites and want them to run under a single test suite or a single describe test block. I have placed them like...

describe('',()=>{  
  require('test-suite1.test.ts')
  require('test-suite2.test.ts')
  require('test-suite3.test.ts')
  ...
  ....
}

Can anyone suggest me anyother way to replace the require and still run all the test under single test suite?

like image 907
Bhagyesh Radiya Avatar asked Sep 10 '25 22:09

Bhagyesh Radiya


1 Answers

The layout of your tests can be something like this:

describe('All of the functions from this file', () => {
  describe('first function', () => {
    test('first function test one', () => {
      // ... tests for the first function
    });
    test('first function test two', () => {
      // ... tests for the first function
    });
    test('first function test three', () => {
      // ... tests for the first function
    });

  });
  describe('second function', () => {
    test('second function test one', () => {
      // ... tests for the second function
    });
    test('second function test two', () => {
      // ... tests for the second function
    });
    test('second function test three', () => {
      // ... tests for the second function
    });
  });
});
like image 157
vlad Avatar answered Sep 13 '25 12:09

vlad