-
Notifications
You must be signed in to change notification settings - Fork 34
TypeScript setup
James Adarich edited this page Aug 1, 2019
·
8 revisions
You'll need TypeScript 2.0 or greater to use Alsatian so go ahead and install it!
npm install typescript --save-dev
Add your tsconfig.json
more info on creating this here and ensure it contains the experimentalDecorators
flag set to true.
{
"compilerOptions": {
...
"experimentalDecorators": true,
...
}
...
}
Now for installing alsatian it's simple, we're on NPM
npm install alsatian --save-dev
Write some tests and run them
alsatian "./**/*.spec.ts"
And you're done! :)
You may get a build error along the lines of
node_modules/alsatian/core/decorators/async-test-decorator.d.ts(2,149): error TS2304: Cannot find name 'Promise'.
node_modules/alsatian/core/running/test-item.d.ts(10,27): error TS2304: Cannot find name 'Promise'.
node_modules/alsatian/core/running/test-runner.d.ts(9,46): error TS2304: Cannot find name 'Promise'.
Fear not though all you need to do is add es2015 to your tsconfig.json
compilerOptions libs
{
"compilerOptions": {
...
"lib": [ "es2015" ],
...
}
...
}