Test Runner

FuseBox provides a very convenient and a blazy fast test runner based on TypeScript.

The concept is simple:


Just remove instructions, create an isolated task, and test(). The entire FuseBox is powered by FuseBox tests. Check them out here:


git clone https://github.com/fuse-box/fuse-box-examples.git
npm install
cd examples/test-runner
node fuse.js 

Default pattern

FuseBox will take this pattern [**/**.test.ts] which can be overriden.


Don't change the ending - `test.ts`. The test runner is at its very early stage

Test file

You FuseBox should assertion library to chain and validate your objects.

import { should } from "fuse-test-runner";
import { Bar } from "../Bar";

export class BarTest {
    "Should be okay"() {

    "Should construct Bar Object"() {
        should(new Bar())
            .mutate((bar: Bar) => bar.name)
            .equal("I am bar")

Methods can be written as strings to improve the readability.

  • 1

    Test runner respects returns promises as well as done callbacks

  • 2

    All tests are execute in order they were defined

Before and After

Like in mocha, you can do the following:

export class BarTest {

Assertion API

Install first:

npm install fuse-test-runner

Assertion API is a chain, you can apply multiple validations for one object. for example:

    .mutate(x => x.get("./something"))
    .mutate(x => x.get("foo"))
    .mutate(x => x.name)
name Meaning
equal() Equals stricty
deepEqual() Equals deeply
notEqual() Not equals stricty
match(/foo/) Matches using regexp
notMatch(/foo/) Should not match
notMatch(/foo/) Should not match
findString("foo") Should find a string
notFindString("foo") Should not find a string
beOkay() Should be not undefined or null
haveLength(2) Object should have length
throwException(() => { your code }) A callback should throw an exception
beTrue() Should be true
beFalse() Should be false
beArray() Should be an array
beObject() Should be an object
bePlainObject() Should be a plain objec
bePromise() Should be a promise
beFunction() Should be a function
beNumber() Should be a number
beBoolean() Should be boolean
beUndefined() Should be undefined
beMap() Should be a map
beSet() Should be a set
beInstanceOf() Should be instance of
beFalse() Should be false
mutate(x => x.hello) Changes the chains' pointer