Micro Test-Runner

Simple, semantic unit tester for JS and TS.

npm install micro-test-runner

import test from 'micro-test-runner';

import { yourFunction } from 'yourProject';


console.log(


test(yourFunction)// Test yourFunction…

.times(3) // Three times…

.with(['Hello', 'world']) // With these arguments…

.expect(['Hello world'])// And expect these results.


);

import test from 'micro-test-runner';

import { yourFunction } from 'yourProject';



test(yourFunction)// Test yourFunction…

.logging('Awesome') // Logging the outcome…

.with(['Hello', 'world']) // With these arguments…

.expect(['Hello world']); // And expect these results.

import test from 'micro-test-runner';

import { apiCall } from 'yourProject';



await test(apiCall) // Test your api call…

.async()// Asynchronously…

.logging('API') // Logging the outcome…

.with([ // With these arguments…

'https://example.com/api',

'/endpoint'

])

.expect(['Hello world']); // And expect these results.

import test, { FailureLogSeverity } from 'micro-test-runner';

import YourClass from 'yourProject';



test(YourClass.method)// Test your method…

.context(YourClass) // In this context…

.logging('Classy',// Logging failures as errors…

FailureLogSeverity.ERROR)

.with(['Hello', 'world']) // With these arguments…

.expect(['Hello world']); // And expect these results.

Result

pass > true

fail > false

pass > ✓ Awesome test passed.

fail > ✕ Awesome test failed.

pass > ✓ API test passed.

fail > ✕ API test failed.

pass > ✓ Classy test passed.

fail > Error: ✕ Classy test failed. Stacktrace…

Bam! It's just that easy 💥