Files
DefinitelyTyped/types/atom-mocha-test-runner/atom-mocha-test-runner-tests.ts
Glen M ea4008d4e8 Add definitions for atom-mocha-test-runner. (#20380)
* Add definitions for atom-mocha-test-runner.

* Remove the editorconfig.

* Atom: remove editorconfigs, linebreak-style, and all lint disables.
2017-10-09 15:43:18 -07:00

39 lines
965 B
TypeScript

import { createRunner } from "atom-mocha-test-runner";
import defaultMochaRunner = require("atom-mocha-test-runner");
const extraOptions = {
testSuffixes: ["-spec.js", "-spec.coffee"],
};
function mochaSetup(mocha: Mocha) {
mocha.addFile("test.file");
}
let testRunner = createRunner();
testRunner = createRunner(extraOptions);
testRunner = createRunner(extraOptions, mochaSetup);
testRunner = createRunner({
colors: true,
globalAtom: true,
htmlTitle: "Test Title",
reporter: "dot",
testSuffixes: ["test.file"],
});
declare const atom: Atom.AtomEnvironment;
declare const blob: object;
declare let num: number;
async function runTests(): Promise<number> {
const runnerArgs: Atom.Structures.TestRunnerArgs = {
testPaths: ["/var/test"],
logFile: "/var/log",
headless: false,
buildDefaultApplicationDelegate: () => blob,
buildAtomEnvironment: () => atom,
};
num = await defaultMochaRunner(runnerArgs);
return await testRunner(runnerArgs);
}