tests: Promisify helper.init()

This commit is contained in:
Richard Hansen 2021-05-09 18:45:43 -04:00
parent c714ff1014
commit 20df34bb67
2 changed files with 21 additions and 24 deletions

View file

@ -1,6 +1,8 @@
'use strict';
$(() => {
// $(handler), $().ready(handler), $.wait($.ready).then(handler), etc. don't work if handler is an
// async function for some bizarre reason, so the async function is wrapped in a non-async function.
$(() => (async () => {
const stringifyException = (exception) => {
let err = exception.stack || exception.toString();
@ -154,15 +156,11 @@ $(() => {
describe(`${desc}.js`, function () { require(spec); });
}
// initialize the test helper
helper.init(() => {
// configure and start the test framework
const grep = getURLParameter('grep');
if (grep != null) {
mocha.grep(grep);
}
const runner = mocha.run();
customRunner(runner);
});
});
await helper.init();
const grep = getURLParameter('grep');
if (grep != null) {
mocha.grep(grep);
}
const runner = mocha.run();
customRunner(runner);
})());