Web Dev Solutions

Catalin Mititiuc

From f0b5c1a511ba794609178e5f08e7c8f8c2ec1723 Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Thu, 6 Mar 2025 15:27:27 -0800 Subject: Add Jest testing framework --- __tests__/integration/setup.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 __tests__/integration/setup.js (limited to '__tests__/integration/setup.js') diff --git a/__tests__/integration/setup.js b/__tests__/integration/setup.js new file mode 100644 index 0000000..b50e1ca --- /dev/null +++ b/__tests__/integration/setup.js @@ -0,0 +1,21 @@ +const { spawn } = require('child_process'); + +module.exports = async function (globalConfig, projectConfig) { + console.info('\nSpawning server process...'); + const child = spawn('node', ['server.js']); + + child.stdout.on('data', data => { + console.log(`${data}`); + }); + + globalThis.__INTEG_TEST_SERVER_PID__ = child.pid; + + child.stderr.on('data', data => { + const str = data.toString(); + console.log('[server]', str); + + if (str.includes(projectConfig.globals.testServerUrl)) { + setTimeout(resolve, 200); + } + }); +}; -- cgit v1.2.3