mini-jest
Attempt at writing my own minimal test runner that implements a subset of the features of Jest.
Note: This is just an experiment for my own learning and is in no way meant to be used in production.
API
Similar to Jest. The describe
, it
, test
, expect
functions are exported.
Usage
It works for an example taken off Jest homepage:
const { describe, expect, it, test } = require('mini-jest');
const myBeverage = {
delicious: true,
sour: false,
};
describe('test that', () => {
describe('my beverage', () => {
test('is delicious', () => {
expect(myBeverage.delicious).toBeTruthy();
});
test('is not sour', () => {
expect(myBeverage.sour).toBeFalsy();
});
});
});
Example
$ npm test
> [email protected] test /Users/yangshun/Developer/mini-jest
> node ./__tests__/meta.test.js
expect tests
โ toBe works correctly (0ms)
โ toBeFalsy works correctly (0ms)
toBeGreaterThan works correctly
โ with positive numbers (0ms)
โ with negative numbers (0ms)
โ with mixed numbers (0ms)
toBeGreaterThanOrEqual works correctly
โ with positive numbers (0ms)
โ with negative numbers (0ms)
โ with mixed numbers (0ms)
toBeLessThan works correctly
โ with positive numbers (0ms)
โ with negative numbers (0ms)
โ with mixed numbers (0ms)
toBeLessThanOrEqual works correctly
โ with positive numbers (0ms)
โ with negative numbers (0ms)
โ with mixed numbers (0ms)
โ toBeNull works correctly (0ms)
โ toBeTruthy works correctly (1ms)
โ toBeUndefined works correctly (0ms)
โ toContain works correctly (0ms)
โ toHaveLength works correctly (0ms)