[MM-45448] Force electron processes to close after every test on Windows (#2207)

This commit is contained in:
Devin Binnie
2022-07-25 09:41:19 -04:00
committed by GitHub
parent 40c072981a
commit 821112c038
28 changed files with 118 additions and 339 deletions

View File

@@ -5,6 +5,8 @@
const fs = require('fs');
const ps = require('ps-node');
const path = require('path');
const {_electron: electron} = require('playwright');
@@ -119,6 +121,28 @@ module.exports = {
demoMattermostConfig,
cmdOrCtrl,
async clearElectronInstances() {
if (process.platform !== 'win32') {
return Promise.resolve();
}
return new Promise((resolve, reject) => {
ps.lookup({
command: 'electron',
}, (err, resultList) => {
if (err) {
reject(err);
}
resultList.forEach((process) => {
if (process && process.command === electronBinaryPath && !process.arguments.some((arg) => arg.includes('electron-mocha'))) {
ps.kill(process.pid);
}
});
resolve();
});
});
},
cleanTestConfig() {
[configFilePath, boundsInfoPath].forEach((file) => {
try {