Fix race condition, error reporting

This commit is contained in:
Radon Rosborough 2020-07-30 08:47:46 -06:00
parent 0945ad6550
commit 80119ba66d
3 changed files with 3 additions and 2 deletions

View File

@ -72,7 +72,6 @@ export class Session {
this.lang = lang; this.lang = lang;
this.logPrimitive = log; this.logPrimitive = log;
this.log(`Creating session, language ${this.lang}`); this.log(`Creating session, language ${this.lang}`);
this.setup();
} }
run = async (args: string[], options?: Options) => { run = async (args: string[], options?: Options) => {

View File

@ -78,7 +78,7 @@ function addWebsocket(
); );
ws.close(); ws.close();
} else { } else {
new api.Session(ws, lang, console.log); new api.Session(ws, lang, console.log).setup();
} }
}); });
return app; return app;

View File

@ -75,6 +75,7 @@ class Test {
this.timedOut = true; this.timedOut = true;
this.handleUpdate(); this.handleUpdate();
}, TIMEOUT_MS); }, TIMEOUT_MS);
await session.setup();
switch (this.type) { switch (this.type) {
case "ensure": case "ensure":
await this.testEnsure(); await this.testEnsure();
@ -273,6 +274,7 @@ async function main() {
} catch (err) { } catch (err) {
console.error("failed:"); console.error("failed:");
console.error(test.getLog()); console.error(test.getLog());
console.error(err);
} }
} }
} }