Skip to content

Raynos/suitestack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)
    })
})

About

simplified unit testing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages