import * as path from "path"; import Mocha from "mocha"; import { glob } from "glob"; export async function run(): Promise { const mocha = new Mocha({ ui: "tdd", color: true, timeout: 60000 }); const testsRoot = path.resolve(__dirname); const files = await glob("**/*.test.js", { cwd: testsRoot }); for (const f of files) mocha.addFile(path.resolve(testsRoot, f)); await new Promise((resolve, reject) => { mocha.run((failures) => (failures > 0 ? reject(new Error(`${failures} E2E test(s) failed`)) : resolve())); }); }