π§ͺ test
test(message: string, cb: () => void)|test(cb: () => void)
test is a helper to assist you in such cases:
- Use the 
beforeEachandafterEachfor eachtestperformed - Isolate or group your tests in the same file
 - Run tests in the same file in parallel
 
Basic Usageβ
Isolating scopesβ
import { test, assert } from 'poku';
test(() => {
  const myVar = 'a';
  assert.strictEqual(myVar, 'a', 'My first test helper');
});
test(() => {
  const myVar = 'b';
  assert.strictEqual(myVar, 'b', 'My second test helper');
});
Grouping testsβ
import { test, assert } from 'poku';
test(() => {
  assert.equal(1 + 1, 2, '1 + 1 should be 2');
  assert.equal(2 + 2, 4, '2 + 2 should be 4');
});
import { test, assert } from 'poku';
test('Sum tests', () => {
  assert.equal(1 + 1, 2);
  assert.equal(2 + 2, 4);
});
import { test, assert } from 'poku';
test('Sum tests', () => {
  assert.equal(1 + 1, 2, '1 + 1 should be 2');
  assert.equal(2 + 2, 4, '2 + 2 should be 4');
});
Waiting for promisesβ
import { test } from 'poku';
await test(async () => {
  // do anything you want
});
await test(async () => {
  // do anything you want
});
Running in parallelβ
import { test } from 'poku';
test(async () => {
  // do anything you want
});
test(async () => {
  // do anything you want
});
Waiting for multiple promisesβ
import { test } from 'poku';
// do something before
await Promise.all([
  test(async () => {
    // do anything you want
  }),
  test(async () => {
    // do anything you want
  }),
]);
// do something after
tip
You can think on it as beforeAll and afterAll.