Introduction
Installation
To install, please execute the following command:
npm install kensajs --save-devUsage
Below is the simplest way to use it:
import Kensa from 'kensajs';import { testFunction } from './testFunction';
const ks = Kensa();
ks.mainTitle('Test Title');
ks.test({ title: 'Test Item', input: testFunction(1, 1), expect: 2,});
ks.run();- Import Kensa using import Kensa from ‘kensajs’;.
- Use test() to add tests.
- Execute the tests using run().
Execution Result
📄 Test Title ✓ Test Item
TOTAL: 1, PASS: 1, FAIL: 0Automation
By creating a .ks.js or .ks.ts file, you can automate the tests. Below is an example of automation:
- Add a script to package.json.
"test": "kensa"- Create a .ks.js or .ks.ts file. If you are executing a .ks.ts file, please install ts-node.
npm install ts-node --save-devThe creation method is as follows:
import Kensa from 'kensajs';
let ks = Kensa('Test Title');
ks.test({ title: 'Test Item', input: testFunction(2, 4), expect: 6,});
ks.run();- Import Kensa using import Kensa from ‘kensajs’;.
- Use test() to add tests.
- Execute the tests using run().
Test Execution
npm run testExecution Result
📄 Test Title ✓ Test Item
TOTAL: 1, PASS: 1, FAIL: 0