kensajs
v0.4.1
Published
A Simple and Intuitive JavaScript Testing Library
Readme
KensaJs
KensaJs is a testing library that prioritizes simplicity, lightness, and ease of use, aiming to provide an optimal tool for JavaScript and TypeScript developers looking to efficiently conduct unit tests.
Features
- Simple: Designed to be simple to implement.
- Ease of Use: Uses .js and .ts files, enabling testing during development.
- Automated: By creating .ks.js or .ks.ts files, testing can be automated.
Installation
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: 0more information, please see the documentation.
License
KensaJs is open source software released under the ISC License. For the full license text, please see the LICENSE file in our GitHub repository.
