| 6 | * Execute tests with given filter conditions as a child process |
| 7 | */ |
| 8 | const executeTests = async function () { |
| 9 | try { |
| 10 | const workingDir = path.join(__dirname, '../'); |
| 11 | const relativeBuildPath = path.join('../', 'unit-test'); |
| 12 | const buildPath = path.join(__dirname, './unit-test'); |
| 13 | const envVars = { ...process.env, REL_BUILD_PATH: relativeBuildPath, BUILD_PATH: buildPath }; |
| 14 | |
| 15 | console.log('Starting to run tests in ', buildPath, new Date()); |
| 16 | |
| 17 | const code = await runChildProcess('test', { cwd: workingDir, env: envVars }); |
| 18 | |
| 19 | if (code !== '0') { |
| 20 | process.exitCode = code; |
| 21 | process.exit(process.exitCode); |
| 22 | } |
| 23 | |
| 24 | console.log('Completed running tests', new Date()); |
| 25 | } catch (e) { |
| 26 | console.log('Error occured running tests', new Date()); |
| 27 | } |
| 28 | }; |
| 29 | |
| 30 | executeTests(); |