[MM-45448] Force electron processes to close after every test on Windows (#2207)
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user