Properly wait for workaround (#13286)

This commit is contained in:
Brennan 2019-08-23 11:15:40 -07:00 committed by GitHub
parent 3b5a9e51d2
commit 6d311041f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 3 deletions

View File

@ -171,9 +171,6 @@ const configFile = sauce ?
path.resolve(__dirname, "karma.local.conf.js");
debug(`Loading Karma config file: ${configFile}`);
// Workaround for 'wd' not installing correctly. https://github.com/karma-runner/karma-sauce-launcher/issues/117
exec("node ../node_modules/wd/scripts/build-browser-scripts.js");
// Gross but it works
process.env.ASPNETCORE_SIGNALR_TEST_ALL_BROWSERS = allBrowsers ? "true" : null;
const config = (karma as any).config.parseConfig(configFile);
@ -197,6 +194,19 @@ if (sauce) {
}
}
// Workaround for 'wd' not installing correctly. https://github.com/karma-runner/karma-sauce-launcher/issues/117
function ensureWdInstalled() {
return new Promise((resolve, reject) => {
exec(`node ${__dirname}/../node_modules/wd/scripts/build-browser-scripts.js`, { timeout: 30000 }, (error: any, stdout, stderr) => {
if (error) {
console.log(error.message);
reject(error);
}
resolve();
});
});
}
function runKarma(karmaConfig) {
return new Promise<number>((resolve, reject) => {
const server = new karma.Server(karmaConfig, (exitCode: number) => {
@ -289,6 +299,8 @@ function runJest(httpsUrl: string, httpUrl: string) {
debug(`Functional Test Server has started at ${httpsUrl} and ${httpUrl}`);
await ensureWdInstalled();
// Start karma server
const conf = {
...config,