🧪 describe
describe(title: string, options?: DescribeOptions)|describe(message: string, cb: () => void)|describe(cb: () => void)
Using as test titles
On Poku, describe can be used just as a pretty console.log to title your test suites in the terminal.
import { describe, assert } from 'poku';
describe('Test Title');
assert(true, '1');
assert(true, '2');
Personalization
background
Change the background color for your personal title.
import { describe, assert } from 'poku';
describe('Test Title', { background: 'blue' });
assert.ok(true, '1');
assert.ok(true, '2');
Available Colors
whiteblackgreyredgreenyellowbluemagentacyanbrightRedbrightGreenbrightYellowbrightBluebrightMagentabrightCyan
icon (prefix)
Poku also allows the prefix customization.
The default icon is
☰.
import { describe, assert } from 'poku';
describe('Test Title', { icon: '🔬' });
assert.ok(true, '1');
assert.ok(true, '2');
Grouping tests (usual)
import { describe, assert } from 'poku';
describe(() => {
assert.equal(1 + 1, 2, '1 + 1 should be 2');
assert.equal(2 + 2, 4, '2 + 2 should be 4');
});
import { describe, assert } from 'poku';
describe('Sum tests', () => {
assert.equal(1 + 1, 2);
assert.equal(2 + 2, 4);
});
import { describe, assert } from 'poku';
describe('Sum tests', () => {
assert.equal(1 + 1, 2, '1 + 1 should be 2');
assert.equal(2 + 2, 4, '2 + 2 should be 4');
});