Skip to content
simplified unit testing
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
examples
node_modules
test
.gitignore
LICENCE
Makefile
README.md
index.js
package.json

README.md

suitestack

simplified unit testing

Example

var test = require("suitestack"),
    assert = require("assert"),
    noOfTests = 0

// report
test.on("error", function (err) {
    console.error("FAIL:", err.message)
})

test.on("pass", function (name) {
    console.log("PASS:", name)
})

test.on("test", function () {
    noOfTests++
})

test.on("test end", function () {
    noOfTests--
})

test.on("end", function () {
    assert(noOfTests === 0, "all tests did not finish")
})

test("A synchronous unit test", function () {
    assert.equal(true, true, "JavaScript hates us :(")
})

test("A nested test", function (test) {
    test("an inner test", function () {
        assert(true, "Does not work inside")
    })

    test("An asynchronous test", function (test, done) {
        setTimeout(function () {
            assert(true, "asynchronous tests do not work")
            done()
        }, 50)
    })
})
Something went wrong with that request. Please try again.