This commit is contained in:
John Kleinschmidt
2024-11-05 17:28:14 -05:00
parent e616618580
commit 8e0c382ef3
2 changed files with 23 additions and 17 deletions

View File

@@ -169,23 +169,6 @@ async function runTestUsingElectron (specDir, testName) {
runnerArgs.unshift(path.resolve(__dirname, 'dbus_mock.py'), exe);
exe = 'python3';
}
const fifteenMinutes = 15 * 60 * 1000;
setTimeout(async () => {
console.log(`${fail} Electron tests timed out after 15 minutes.`);
if (process.platform === 'win32') {
const scArgs = [
path.resolve(__dirname, 'screenCapture.bat'),
'screen.png'
];
const ARTIFACT_DIR = path.join(__dirname, '..', 'spec', 'artifacts');
await fs.mkdirSync(ARTIFACT_DIR, { recursive: true });
childProcess.spawnSync('call', scArgs, {
cwd: ARTIFACT_DIR,
stdio: 'inherit'
});
}
process.exit(1);
}, fifteenMinutes);
const { status, signal } = childProcess.spawnSync(exe, runnerArgs, {
cwd: path.resolve(__dirname, '../..'),
stdio: 'inherit'

View File

@@ -1,5 +1,6 @@
const { app, protocol } = require('electron');
const childProcess = require('node:child_process');
const fs = require('node:fs');
const path = require('node:path');
const v8 = require('node:v8');
@@ -169,9 +170,31 @@ app.whenReady().then(async () => {
process.exit(1);
}
const fifteenMinutes = 15 * 60 * 1000;
const testTimeout = setTimeout(async () => {
console.log('Electron tests timed out after 15 minutes.');
if (process.platform === 'win32') {
const scArgs = [
'screen.png'
];
const ARTIFACT_DIR = path.join(__dirname, 'artifacts');
fs.mkdirSync(ARTIFACT_DIR, { recursive: true });
const { stdout, stderr } = childProcess.spawnSync(path.resolve(__dirname, '..', 'script', 'screenCapture.bat'), scArgs, {
cwd: ARTIFACT_DIR,
stdio: 'inherit'
});
console.log(`screenCap: ${stdout} ${stderr}`);
}
process.exit(1);
}, fifteenMinutes);
const cb = () => {
console.log('In SPEC CB');
// Ensure the callback is called after runner is defined
process.nextTick(() => {
clearTimeout(testTimeout);
console.log('In SPEC CB, process next tick');
process.exit(runner.failures);
});
};