How to use Jest global Setup and Teardown in a nodeJS project?
Try with this jest.config.js:
module.exports = { testEnvironment: "node", globalSetup: '<rootDir>/src/testSetup.ts'};
And in testSetup.ts you can do:
// testSetup.tsmodule.exports = async () => { const app = require("../../app"); server = http.createServer(app); server.listen(done);};