diff --git a/packages/node-integration-tests/jest.config.js b/packages/node-integration-tests/jest.config.js index 9a2862dd9b8d..fe377b41b880 100644 --- a/packages/node-integration-tests/jest.config.js +++ b/packages/node-integration-tests/jest.config.js @@ -4,4 +4,5 @@ module.exports = { globalSetup: '/utils/setup-tests.ts', ...baseConfig, testMatch: ['**/test.ts'], + setupFilesAfterEnv: ['./jest.setup.js'], }; diff --git a/packages/node-integration-tests/jest.setup.js b/packages/node-integration-tests/jest.setup.js new file mode 100644 index 000000000000..7c1837cab523 --- /dev/null +++ b/packages/node-integration-tests/jest.setup.js @@ -0,0 +1,2 @@ +// Increases test timeout from 5s to 45s +jest.setTimeout(45000); diff --git a/packages/node-integration-tests/package.json b/packages/node-integration-tests/package.json index 0cc4a697a976..b6fb1dba74d9 100644 --- a/packages/node-integration-tests/package.json +++ b/packages/node-integration-tests/package.json @@ -17,7 +17,7 @@ "fix:prettier": "prettier --write \"{suites,utils}/**/*.ts\"", "type-check": "tsc", "pretest": "run-s --silent prisma:init", - "test": "jest --runInBand --forceExit", + "test": "jest --forceExit", "test:watch": "yarn test --watch" }, "dependencies": { diff --git a/packages/node-integration-tests/utils/index.ts b/packages/node-integration-tests/utils/index.ts index 50da10fd7820..ad1bb0d4b188 100644 --- a/packages/node-integration-tests/utils/index.ts +++ b/packages/node-integration-tests/utils/index.ts @@ -137,11 +137,9 @@ export class TestEnv { * @return {*} {Promise} */ public static async init(testDir: string, serverPath?: string, scenarioPath?: string): Promise { - const port = await getPortPromise(); - const url = `http://localhost:${port}/test`; const defaultServerPath = path.resolve(process.cwd(), 'utils', 'defaults', 'server'); - const server = await new Promise(resolve => { + const [server, url] = await new Promise<[http.Server, string]>(resolve => { // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access const app = require(serverPath || defaultServerPath).default as Express; @@ -153,8 +151,11 @@ export class TestEnv { } }); - const server = app.listen(port, () => { - resolve(server); + void getPortPromise().then(port => { + const url = `http://localhost:${port}/test`; + const server = app.listen(port, () => { + resolve([server, url]); + }); }); });