alsatian-cli-function
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

alsatian-cli-function

Exports a function to run a provided file using alsatian.

Why?

So you can easily turn each of your alsatian test files into an executable script that doesn't depend on the alsatian CLI. You can just run it with node path/to/your/file.js or ts-node path/to/your/file.ts.

YourTest.ts:

// no globals and typing support out of the box with intellisense
import { Expect, Test, TestFixture } from "alsatian";
import cli from "alsatian-cli-function";
 
@TestFixture("whatever you'd like to call the fixture")
export class YourTestFixture {
    @TestCase(3, 3, 6)
    @Test("addition tests")
    public addTest(firstNumber: number, secondNumber: number, expectedSum: number) {
        Expect(firstNumber + secondNumber).toBe(expectedSum);
    }
}
 
if (require.main === module) {
  (async () => {
    await cli(__filename);
  })();
}

Then: ts-node YourTest.ts to run the tests in that file.

Gratitudes

Thank you to jamesadarich and other contributors for working on alsatian.

Readme

Keywords

none

Package Sidebar

Install

npm i alsatian-cli-function

Weekly Downloads

1

Version

1.0.4

License

GPL-3.0

Unpacked Size

10.2 kB

Total Files

8

Last publish

Collaborators

  • gobengo