Javascript 如何使用Jest和supertest在一个测试套件中放置多个测试套件?

Javascript 如何使用Jest和supertest在一个测试套件中放置多个测试套件?,javascript,node.js,jestjs,supertest,Javascript,Node.js,Jestjs,Supertest,我创建了多个测试套件,并希望它们在单个测试套件或单个测试块下运行。 我把它们放在像 describe('',()=>{ require('test-suite1.test.ts') require('test-suite2.test.ts') require('test-suite3.test.ts') ... .... } 是否有人可以建议我以其他方式替换require并在单个测试套件下运行所有测试?您的测试布局可以如下所示: describe('All of

我创建了多个测试套件,并希望它们在单个测试套件或单个测试块下运行。 我把它们放在像

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

是否有人可以建议我以其他方式替换require并在单个测试套件下运行所有测试?

您的测试布局可以如下所示:

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

这种
require
方式有什么问题?@slideshowp2使用这种方式,我无法跟踪当前正在运行的测试套件,它会在所有测试套件的末尾显示结果。是的,只是这样,但我在不同的文件中有不同的测试套件,我想从一个文件中访问,不想将所有代码放在一个文件中。