https://github.com/balazs4/bft
minimal test-runner for node.js
https://github.com/balazs4/bft
bloat-free cli minimal nodejs test testrunner
Last synced: about 2 months ago
JSON representation
minimal test-runner for node.js
- Host: GitHub
- URL: https://github.com/balazs4/bft
- Owner: balazs4
- Created: 2021-01-10T10:45:13.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-02-05T19:31:03.000Z (over 1 year ago)
- Last Synced: 2025-03-27T07:46:34.039Z (2 months ago)
- Topics: bloat-free, cli, minimal, nodejs, test, testrunner
- Language: JavaScript
- Homepage:
- Size: 27.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# bft
> **b**loat-**f**ree-**t**estrunner for node.js
## usage
```bash
npx bft test.js test/foobar.js path/to/test/file.js
``````javascript
// test.jsconst assert = require('assert').strict;
test('this a test case', () => {
assert.strictEqual(42, 42);
});test('another test', async () => {
const expected = 'foobar';
const actual = await yourCodeUnderTest();
assert.strictEqual(actual, expected);
});test('i do not like the built-in assert module', () => {
throw new Error('no problem; just thrown an execption and this testcase will fail');
});```
## recipes
### watch mode - [onchange](https://www.npmjs.com/package/onchange)
```
npx onchange -i -k '*.test.js' -- npx bft *.test.js
```### coverage - [c8](https://www.npmjs.com/package/c8)
```
npx c8 --all npx bft *.test.js
```## faq
- Can I use the module without messing up with `global`?
- Yes! see [example.test.js](example.test.js)- Where are the `setup` and `teardown` functions?
- In the bloated testrunner ;-) `bft` encourages you to use [AAA - Arrange Act Assert](http://wiki.c2.com/?ArrangeActAssert) pattern.- "If bloat-free, then color-free please"
- `NO_COLOR=1 npx bft test.js` is your friend.## author
balazs4 - https://twitter.com/balazs4
## license
MIT