UNPKG

must

Version:

Testing and assertion library with friendly BDD syntax — awesome.must.be.true(). Many expressive matchers and is test runner and framework agnostic. Follows RFC 2119 with its use of MUST. Good and well tested stuff.

24 lines (20 loc) 671 B
var Must = require("../..") var assert = require("assert") module.exports = function(test, props) { describe("AssertionError", function() { it("must be thrown", function() { assert.throws(test, Must.AssertionError) }) it("must have all properties", function() { try { test() } catch (ex) { assert.deepEqual(ex, props) } }) it("must have correct stack trace", function() { try { test() } catch (ex) { var stack = ex.stack.split(/\r?\n/) assert(stack[0].match(/AssertionError/, "must include AssertionError")) assert(stack[1].match(/[\\\/]test[\\\/]/), "must have test at top") } }) }) }