While running sauce-connect-launcher under a node/jest environment I face some issues.
My environment:
node v12.16.2
npm 6.14.4
jest 25.4.0
sauce-connect-launcher 1.3.1
- The first problem is:
To be able to setup my tests correctly over jest runtime I wrapped it around a Promise as follow:
const sauceConnectLauncherPromise = new Promise((resolve, reject) => {
sauceConnectLauncher(sauceConnectOpts, function (err, sauceConnectProcess) {
if (err) {
reject(err.message);
return;
}
resolve('Sauce Connect ready');
});
});
and used like this:
beforeAll(async () => {
try {
// Start Sauce Connect Proxy
await sauceConnectLauncherPromise;
...
This works, but for the connection to be made to Saucelabs I had to remove:
sauceConnectProcess.close(function () {
console.log("Closed Sauce Connect process");
});
from sauceConnectLauncher callback. This line causing the tunnel to be aborted when executed...
Is it normal?
sauceConnectLauncher disposes a child process to create the tunnel.
sauceConnectLauncher callback function embeds sauceConnectProcess but how is it possible to kill this process manually?
I need to kill it for example in an afterAll hook to ensure tests are re-playable
Thanks!
While running
sauce-connect-launcherunder anode/jestenvironment I face some issues.My environment:
node v12.16.2npm 6.14.4jest 25.4.0sauce-connect-launcher 1.3.1To be able to setup my tests correctly over
jestruntime I wrapped it around aPromiseas follow:and used like this:
This works, but for the connection to be made to Saucelabs I had to remove:
from
sauceConnectLaunchercallback. This line causing the tunnel to be aborted when executed...Is it normal?
sauceConnectLauncherdisposes a child process to create the tunnel.sauceConnectLaunchercallback function embedssauceConnectProcessbut how is it possible to kill this process manually?I need to kill it for example in an
afterAllhook to ensure tests are re-playableThanks!