rokot-test
Rokot - Rocketmakers TypeScript NodeJs Platform
Introduction
A typescript testing library for nodejs applications
Created to bring together the suite of testing tools we use and make writing test scripts as simple as possible.
Contributing
Installation
After pulling the source
npm i
Getting Started
Installation
Install via npm
npm i rokot-test --save-dev
Setup
Modify your package.json
to invoke mocha
within the test script (ensure you compile the typescript before running mocha
):
- WebPack
{
"scripts": {
"test": "webpack --progress && mocha"
}
}
- Typescript
{
"scripts": {
"test": "tsc -p source && mocha"
}
}
Create a test
folder within the root of your project and create a mocha.opts
file containing the path to your compiled js test file(s):
dist/tests/*-test.js
Example
Create a <test>.ts
file:
; describe"Every Application should have a Test suite",
The full set of imports are:
import {expect,sinon,supertest,chai} from "rokot-test";
Now, become a tester!!!
Running
To execute your tests (via the test script you specified earlier within package.json
):
npm test
Consumed Libraries
mocha
test framework engine (including teamcity reporter)
chai
assertions library (with additional plugins)
- promise (via chai-as-promised)
- array (via chai-things)
sinon
Test spies, stubs and mocks
supertest
HTTP assertions (for express route testing)