micro-should
Simplest zero-dependency testing framework, a drop-in replacement for Mocha.
Supports async cases. Works with any assertion library.
should(title, case)
(or it(title, case)
) syntaxshould.only(title, case)
allows to limit tests to only one caseshould.skip(title, case)
allows to skip functions instead of commenting them outdescribe(prefix, cases)
for nested executionshould.run()
must always be executed in the endshould.runParallel()
for CPU-intensive tasks, would ramp up threads equal to CPU count
npm install micro-should
Usage
const { should } = require('micro-should');
const assert = require('assert');
should('add two numbers together', () => {
assert.equal(2 + 2, 4);
});
should('catch errors', () => {
assert.throws(() => {
throw new Error('invalid');
});
});
should('produce correct promise result', async () => {
const fs = require('fs').promises;
const data = await fs.readFile('README.md', 'utf-8');
assert.ok(data.includes('Minimal testing'));
});
const { describe } = require('micro-should');
describe('during any time of day', () => {
describe('without hesitation', () => {
should('multiply two numbers together', () => {
assert.equal(2 * 2, 4);
});
should('multiply three numbers together', () => {
assert.equal(3 * 3 * 3, 27);
});
});
});
should.run();
License
MIT (c) Paul Miller (https://paulmillr.com), see LICENSE file.