Skip to content

Running with TS Node

James Richford edited this page Jan 27, 2018 · 2 revisions

Good news is with ts-node there's not even a need to compile your tests or code to run the tests simply add the following file to your solution

import { TapBark } from "tap-bark";
import { TestSet, TestRunner } from "alsatian";

(async () =>
{
    const testSet = TestSet.create();
    testSet.addTestsFromFiles('./**/*.spec.ts');

    const testRunner = new TestRunner();

    testRunner.outputStream
        .pipe(TapBark.create().getPipeable())
        .pipe(process.stdout);

    await testRunner.run(testSet);
})().catch(e =>
{
    console.error(e);
    process.exit(1);
});

then run it with ts-node through the cli or your package.json ts-node ./tests/runner.ts

and you're done!

Thanks to @brad-jones

Clone this wiki locally