π§ͺ 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
white
black
grey
red
green
yellow
blue
magenta
cyan
brightRed
brightGreen
brightYellow
brightBlue
brightMagenta
brightCyan
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');
});