beartest-js
v6.0.4
Published
Bear Bones Testing
Downloads
175
Readme
Beartest is an extremely simple JavaScript test runner inspired by Baretest, Playwright, and Jest. It has a tiny footprint while maintaining a familiar API.
Install
npm install --save-dev beartest-js
yarn add beartest-js -D
Why Beartest?
Jest, Mocha, and similar testing frameworks are richly featured, broadly compatible, and highly customizable. Beartest is none of those things. If you want features look somewhere else. Beartest is meant to be simple and understandable, without the complexity of other testing frameworks. Inspired by Baretest, it seeks to deliver an API similar to Jest's with minimal code.
Compatibility
The Beartest test runner uses common js to load files.
Usage
Beartest implements the following functions describe
, it
, beforeAll
, beforeEach
, afterEach
, afterAll
, it.skip
, and it.only
. All provided functions work in a similar way as the corresponding functions in Jest.
Example
import { test } from "beartest-js";
import assert from "assert";
test.describe("Math Testing", () => {
test("should add correctly", async () => {
assert.strictEqual(1 + 2, 3);
});
test("should subtract correctly", async () => {
assert.strictEqual(3 - 2, 1);
});
});
Running Tests
Additionally, a very basic test runner is included. This test runner accepts a glob pattern as a command line argument. The test runner can be invoked with yarn beartest "glob-pattern"
. By default, it will look for **/*.test.js
.
Suggested package script:
"scripts": {
"test": "beartest"
}
License
Licensed under MIT.