Properly wait for karma to exit (#9315)
This commit is contained in:
parent
7d1bcd1235
commit
b1ca2c1155
|
|
@ -195,10 +195,9 @@ if (sauce) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function runKarma(karmaConfig) {
|
function runKarma(karmaConfig) {
|
||||||
return new Promise<karma.TestResults>((resolve, reject) => {
|
return new Promise<number>((resolve, reject) => {
|
||||||
const server = new karma.Server(karmaConfig);
|
const server = new karma.Server(karmaConfig, (exitCode: number) => {
|
||||||
server.on("run_complete", (browsers, results) => {
|
resolve(exitCode);
|
||||||
return resolve(results);
|
|
||||||
});
|
});
|
||||||
server.start();
|
server.start();
|
||||||
});
|
});
|
||||||
|
|
@ -351,12 +350,10 @@ function runJest(httpsUrl: string, httpUrl: string) {
|
||||||
if (config.browsers.length === 0) {
|
if (config.browsers.length === 0) {
|
||||||
console.log("Unable to locate any suitable browsers. Skipping browser functional tests.");
|
console.log("Unable to locate any suitable browsers. Skipping browser functional tests.");
|
||||||
} else {
|
} else {
|
||||||
karmaExit = (await runKarma(conf)).exitCode;
|
karmaExit = (await runKarma(conf));
|
||||||
}
|
|
||||||
|
|
||||||
if (karmaExit) {
|
|
||||||
console.log(`karma exit code: ${karmaExit}`);
|
console.log(`karma exit code: ${karmaExit}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`jest exit code: ${jestExit}`);
|
console.log(`jest exit code: ${jestExit}`);
|
||||||
|
|
||||||
process.exit(jestExit !== 0 ? jestExit : karmaExit);
|
process.exit(jestExit !== 0 ? jestExit : karmaExit);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue