pax_global_header00006660000000000000000000000064127253375310014522gustar00rootroot0000000000000052 comment=b36f593951c1487fa33747c9911025734923f28c assertion-error-1.0.2/000077500000000000000000000000001272533753100146605ustar00rootroot00000000000000assertion-error-1.0.2/.gitignore000066400000000000000000000002011272533753100166410ustar00rootroot00000000000000lib-cov *.seed *.log *.csv *.dat *.out *.pid *.gz pids logs results build components node_modules npm-debug.log coverage.html assertion-error-1.0.2/.npmignore000066400000000000000000000001501272533753100166530ustar00rootroot00000000000000docs/ test/ build/ components/ support/ coverage.html component.json lib-cov .travis.yml Makefile *.swp assertion-error-1.0.2/.travis.yml000066400000000000000000000005611272533753100167730ustar00rootroot00000000000000language: node_js node_js: - 0.10 deploy: provider: npm email: jake@alogicalparadox.com api_key: secure: AgNQTECM/3Gh0q77gkrMx0jASgRh/dysPdUf7Zdsm1k9Gt+i4H99k2L8lVWqpLF1+e6lhWg9w4C08Xgz6tuOTPZZr6UzeRDl+ZjniTYK3E/tpcUbqAQxxgD4b3iA6BLbF0YKGofnWrMtXBBWI8X0jekxncu7sWdBuieyhg33fik= on: tags: true repo: chaijs/assertion-error all_branches: true assertion-error-1.0.2/History.md000066400000000000000000000006231272533753100166440ustar00rootroot000000000000001.0.1 / 2015-03-04 ================== * Merge pull request #2 from simonzack/master * fixes `.stack` on firefox 1.0.0 / 2013-06-08 ================== * readme: change travis and component urls * refactor: [*] prepare for move to chaijs gh org 0.1.0 / 2013-04-07 ================== * test: use vanilla test runner/assert * pgk: remove unused deps * lib: implement * "Initial commit" assertion-error-1.0.2/Makefile000066400000000000000000000010611272533753100163160ustar00rootroot00000000000000 # # Tests # test: test-node test-node: @printf "\n ==> [Node.js]\n" @NODE_ENV=test node ./test/index.js test-browser: @printf "\n ==> [Browser]\n" @make build @printf "\n\n Open 'test/index.html' in your browser to test.\n\n" # # Components # build: components @./node_modules/.bin/component-build --dev components: component.json @./node_modules/.bin/component-install --dev # # Clean up # clean: clean-components clean-components: @rm -rf build @rm -rf components .PHONY: test test-node test-browser .PHONY: clean clean-components assertion-error-1.0.2/README.md000066400000000000000000000032031272533753100161350ustar00rootroot00000000000000# AssertionError [![Build Status](https://travis-ci.org/chaijs/assertion-error.png?branch=master)](https://travis-ci.org/chaijs/assertion-error) > Error constructor for test and validation frameworks that implements standardized AssertionError specification. ## Installation ### Node.js `assertion-error` is available on [npm](http://npmjs.org). $ npm install assertion-error ### Component `assertion-error` is available as a [component](https://github.com/component/component). $ component install chaijs/assertion-error ## License (The MIT License) Copyright (c) 2013 Jake Luer (http://qualiancy.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. assertion-error-1.0.2/component.json000066400000000000000000000006731272533753100175630ustar00rootroot00000000000000{ "name": "assertion-error" , "repo": "chaijs/assertion-error" , "version": "1.0.1" , "description": "Error constructor for test and validation frameworks that implements standardized AssertionError specification." , "license": "MIT" , "keywords": [ "test" , "assertion" , "assertion-error" ] , "main": "index.js" , "scripts": [ "index.js" ] , "dependencies": {} , "development": {} } assertion-error-1.0.2/index.js000066400000000000000000000046061272533753100163330ustar00rootroot00000000000000/*! * assertion-error * Copyright(c) 2013 Jake Luer * MIT Licensed */ /*! * Return a function that will copy properties from * one object to another excluding any originally * listed. Returned function will create a new `{}`. * * @param {String} excluded properties ... * @return {Function} */ function exclude () { var excludes = [].slice.call(arguments); function excludeProps (res, obj) { Object.keys(obj).forEach(function (key) { if (!~excludes.indexOf(key)) res[key] = obj[key]; }); } return function extendExclude () { var args = [].slice.call(arguments) , i = 0 , res = {}; for (; i < args.length; i++) { excludeProps(res, args[i]); } return res; }; }; /*! * Primary Exports */ module.exports = AssertionError; /** * ### AssertionError * * An extension of the JavaScript `Error` constructor for * assertion and validation scenarios. * * @param {String} message * @param {Object} properties to include (optional) * @param {callee} start stack function (optional) */ function AssertionError (message, _props, ssf) { var extend = exclude('name', 'message', 'stack', 'constructor', 'toJSON') , props = extend(_props || {}); // default values this.message = message || 'Unspecified AssertionError'; this.showDiff = false; // copy from properties for (var key in props) { this[key] = props[key]; } // capture stack trace ssf = ssf || arguments.callee; if (ssf && Error.captureStackTrace) { Error.captureStackTrace(this, ssf); } else { try { throw new Error(); } catch(e) { this.stack = e.stack; } } } /*! * Inherit from Error.prototype */ AssertionError.prototype = Object.create(Error.prototype); /*! * Statically set name */ AssertionError.prototype.name = 'AssertionError'; /*! * Ensure correct constructor */ AssertionError.prototype.constructor = AssertionError; /** * Allow errors to be converted to JSON for static transfer. * * @param {Boolean} include stack (default: `true`) * @return {Object} object that can be `JSON.stringify` */ AssertionError.prototype.toJSON = function (stack) { var extend = exclude('constructor', 'toJSON', 'stack') , props = extend({ name: this.name }, this); // include stack if exists and not turned off if (false !== stack && this.stack) { props.stack = this.stack; } return props; }; assertion-error-1.0.2/package.json000066400000000000000000000012301272533753100171420ustar00rootroot00000000000000{ "name": "assertion-error" , "version": "1.0.2" , "description": "Error constructor for test and validation frameworks that implements standardized AssertionError specification." , "author": "Jake Luer (http://qualiancy.com)" , "license": "MIT" , "keywords": [ "test" , "assertion" , "assertion-error" ] , "repository": { "type": "git" , "url": "git@github.com:chaijs/assertion-error.git" } , "engines": { "node": "*" } , "main": "./index" , "scripts": { "test": "make test" } , "dependencies": {} , "devDependencies": { "component": "*" } } assertion-error-1.0.2/test/000077500000000000000000000000001272533753100156375ustar00rootroot00000000000000assertion-error-1.0.2/test/index.html000066400000000000000000000027301272533753100176360ustar00rootroot00000000000000 Browser Tests (assertion-error)

To see results view console.

assertion-error-1.0.2/test/index.js000066400000000000000000000017561272533753100173150ustar00rootroot00000000000000/*! * Include lib */ global.AssertionError = require('..'); /*! * Simple test runner. */ var count = 0 , failures = [] , tests = []; function test (name, fn) { tests.push({ name: name, fn: fn }); } function assert (pass, msg) { if (!pass) throw new Error(msg); } global.suite = function (fn) { fn(test, assert); console.log(''); console.log(' Tests (%d)', tests.length); tests.forEach(function (test) { var err = false , num = ++count; try { test.fn(); } catch (ex) { err = ex; } if (err) { console.log(' %d. [fail] %s', num, test.name); failures.push({ num: num, err: err }); } else { console.log(' %d. [pass] %s', num, test.name); } }); console.log(''); console.log(' Failures (%d)', failures.length); failures.forEach(function (failure) { console.log(' %d. %s', failure.num, failure.err.message); }); console.log(''); process.exit(failures.length); }; /*! * Load the tests */ require('./test'); assertion-error-1.0.2/test/test.js000066400000000000000000000035551272533753100171640ustar00rootroot00000000000000suite(function (test, assert) { test('construction', function () { var err = new AssertionError(); assert(err instanceof Error, 'instanceof Error'); assert(err instanceof AssertionError, 'instanceof AssertionError'); assert(err.name && err.name === 'AssertionError', 'name === "AssertionError"'); }); test('message', function () { var err = new AssertionError('Oops.') , empty = new AssertionError(); assert(err.message === 'Oops.', 'w/ err.message'); assert(empty.message === 'Unspecified AssertionError', 'w/o err.message'); }); test('stack', function() { assert(typeof new AssertionError().stack === 'string'); }); test('custom properties', function () { var err = new AssertionError('good message', { name: 'ShouldNotExist' , hello: 'universe' , message: 'bad message' , stack: 'custom stack' }); assert(err.name === 'AssertionError', 'does not overwrite name'); assert(err.message === 'good message', 'does not overwrite message'); assert(err.hello && err.hello === 'universe', 'has custom property'); // some browsers don't have stack if (err.stack) { assert(err.stack && err.stack !== 'custom stack', 'does not overwrite stack'); } }); test('.toJSON()', function () { var err = new AssertionError('some message', { hello: 'universe' , goodbye: 'known' }); var json = err.toJSON(); assert(json.name === 'AssertionError', 'json has name'); assert(json.message === 'some message', 'json has message'); assert(json.hello === 'universe' && json.goodbye === 'known', 'json has custom properties'); // some browsers don't have stack if (err.stack) { assert('string' === typeof json.stack, 'json has stack'); } var nostack = err.toJSON(false); assert(!nostack.stack, 'no stack on false argument'); }); });