codi-test-framework v0.0.47
Codi Test Framework ๐ถ
Codi is a lightweight JavaScript test framework that allows you to write and run tests for your JavaScript code. It provides a simple and intuitive API for defining test suites and test cases, making it easy to ensure the correctness of your code. โจ
Features โ
- ๐ Simple and expressive API for writing tests
- ๐๏ธ Supports test suites and test cases
- ๐ Provides assertion functions for comparing expected and actual values
- ๐ Colorful output for better readability
- ๐ฅ๏ธ Supports running tests from the command line
- ๐ Compatible with ECMAScript modules (ESM)
- โก Super fast thanks to bun.sh
Installation ๐ฆ
To use Codi in your project, you need to have Node.js installed. You can install Codi as a development dependency using npm:
npm install --save-dev codi-test-framework
For user using codi v0.0.14^ ensure that you have bun v1.1.0 installed.
Usage ๐ ๏ธ
Writing Tests โ๏ธ
To write tests using Codi, create a new test file with a .mjs
extension. Use the describe
function to define a test suite and the it
function to define individual test cases.
Here's an example test file:
import { describe, it, assertEqual } from 'codi-test-framework';
describe('Math operations', () => {
it('should add two numbers correctly', () => {
const result = 2 + 3;
assertEqual(result, 5, 'Addition should work correctly');
});
it('should subtract two numbers correctly', () => {
const result = 5 - 3;
assertEqual(result, 2, 'Subtraction should work correctly');
});
});
Assertion Functions ๐งช
Codi provides several assertion functions to compare expected and actual values:
assertEqual(actual, expected, message)
: Asserts that the actual value is equal to the expected value. โ๏ธassertNotEqual(actual, expected, message)
: Asserts that the actual value is not equal to the expected value. ๐ โโ๏ธassertTrue(actual, message)
: Asserts that the actual value is true. โassertFalse(actual, message)
: Asserts that the actual value is false. โassertThrows(callback, errorMessage, message)
: Asserts that the provided callback function throws an error with the specified error message. ๐ฅ
Running Tests ๐โโ๏ธ
To run the tests, use the runTests
function and provide the directory containing your test files:
import { runTests } from 'codi-test-framework';
runTests('./tests');
You can also run the tests from the command line using the runCLI
function:
codi ./tests
License ๐
This project is licensed under the MIT License.
Feel free to contribute to Codi by opening issues or submitting pull requests. Happy testing! ๐
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
10 months ago
10 months ago
10 months ago
12 months ago
12 months ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago