suite('configuration', function () { var assert = chai.assert; function fooThrows () { assert.equal('foo', 'bar'); } test('Assertion.includeStack is true', function () { var orig = chai.Assertion.includeStack; chai.Assertion.includeStack = true; try { fooThrows(); assert.ok(false, 'should not get here because error thrown'); } catch (err) { chai.Assertion.includeStack = orig; // not all browsers support err.stack if ('undefined' !== typeof err.stack) { assert.include(err.stack, 'fooThrows', 'should have stack trace in error message'); } } }); test('Assertion.includeStack is false', function () { var orig = chai.Assertion.includeStack; chai.Assertion.includeStack = false; try { fooThrows(); assert.ok(false, 'should not get here because error thrown'); } catch (err) { chai.Assertion.includeStack = orig; // IE 10 supports err.stack in Chrome format, but without // `Error.captureStackTrace` support that allows tuning of the error // message. if ('undefined' !== typeof Error.captureStackTrace) { assert.ok(!err.stack || err.stack.indexOf('at fooThrows') === -1, 'should not have stack trace in error message'); } } }); test('AssertionError Properties', function () { var err = new chai.AssertionError({ message: 'Chai!' }); assert.equal(err.toString(), 'Chai!'); }); });