teaspoon 0.7.9 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +382 -260
- data/app/assets/javascripts/teaspoon-angular.js +108 -26241
- data/app/assets/javascripts/teaspoon-jasmine.js +103 -2642
- data/app/assets/javascripts/teaspoon-mocha.js +109 -5416
- data/app/assets/javascripts/teaspoon-qunit.js +107 -2255
- data/app/assets/javascripts/teaspoon-teaspoon.js +0 -1
- data/app/assets/javascripts/teaspoon/angular.coffee +3 -1
- data/app/assets/javascripts/teaspoon/base/hook.coffee +21 -0
- data/app/assets/javascripts/teaspoon/base/reporters/html.coffee +26 -14
- data/app/assets/javascripts/teaspoon/base/reporters/html/progress_view.coffee +1 -1
- data/app/assets/javascripts/teaspoon/base/reporters/html/template.coffee +3 -3
- data/app/assets/javascripts/teaspoon/base/teaspoon.coffee +10 -1
- data/app/assets/javascripts/teaspoon/jasmine.coffee +3 -1
- data/app/assets/javascripts/teaspoon/mocha.coffee +3 -1
- data/app/assets/javascripts/teaspoon/mocha/reporters/html.coffee +1 -1
- data/app/assets/javascripts/teaspoon/qunit.coffee +3 -1
- data/app/assets/javascripts/teaspoon/qunit/reporters/html.coffee +1 -1
- data/app/assets/javascripts/teaspoon/teaspoon.coffee +0 -1
- data/app/assets/stylesheets/teaspoon.css +12 -8
- data/app/controllers/teaspoon/suite_controller.rb +32 -0
- data/app/views/teaspoon/suite/_body.html.erb +0 -0
- data/app/views/teaspoon/suite/_boot.html.erb +4 -0
- data/app/views/teaspoon/suite/_boot_require_js.html.erb +19 -0
- data/app/views/teaspoon/{spec/suites.html.erb → suite/index.html.erb} +6 -7
- data/app/views/teaspoon/suite/show.html.erb +19 -0
- data/bin/teaspoon +1 -1
- data/config/routes.rb +14 -4
- data/lib/generators/teaspoon/install/POST_INSTALL +2 -2
- data/lib/generators/teaspoon/install/install_generator.rb +22 -11
- data/lib/generators/teaspoon/install/templates/_body.html.erb +0 -0
- data/lib/generators/teaspoon/install/templates/_boot.html.erb +4 -0
- data/lib/generators/teaspoon/install/templates/jasmine/env.rb +11 -0
- data/lib/generators/teaspoon/install/templates/jasmine/env_comments.rb +182 -0
- data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.coffee +8 -6
- data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.js +8 -7
- data/lib/generators/teaspoon/install/templates/mocha/env.rb +11 -0
- data/lib/generators/teaspoon/install/templates/mocha/env_comments.rb +182 -0
- data/lib/generators/teaspoon/install/templates/mocha/spec_helper.coffee +13 -13
- data/lib/generators/teaspoon/install/templates/mocha/spec_helper.js +13 -13
- data/lib/generators/teaspoon/install/templates/qunit/env.rb +11 -0
- data/lib/generators/teaspoon/install/templates/qunit/env_comments.rb +182 -0
- data/lib/generators/teaspoon/install/templates/qunit/test_helper.coffee +6 -5
- data/lib/generators/teaspoon/install/templates/qunit/test_helper.js +6 -5
- data/lib/tasks/teaspoon.rake +9 -2
- data/lib/teaspoon.rb +4 -6
- data/lib/teaspoon/command_line.rb +116 -134
- data/lib/teaspoon/configuration.rb +144 -66
- data/lib/teaspoon/console.rb +70 -37
- data/lib/teaspoon/coverage.rb +42 -15
- data/lib/teaspoon/deprecated.rb +65 -0
- data/lib/teaspoon/drivers/base.rb +10 -0
- data/lib/teaspoon/drivers/phantomjs/runner.js +9 -11
- data/lib/teaspoon/drivers/phantomjs_driver.rb +21 -21
- data/lib/teaspoon/drivers/selenium_driver.rb +32 -13
- data/lib/teaspoon/engine.rb +32 -12
- data/lib/teaspoon/environment.rb +16 -12
- data/lib/teaspoon/exceptions.rb +41 -5
- data/lib/teaspoon/exporter.rb +52 -0
- data/lib/teaspoon/formatters/base.rb +171 -0
- data/lib/teaspoon/formatters/clean_formatter.rb +2 -4
- data/lib/teaspoon/formatters/documentation_formatter.rb +60 -0
- data/lib/teaspoon/formatters/dot_formatter.rb +12 -90
- data/lib/teaspoon/formatters/json_formatter.rb +36 -0
- data/lib/teaspoon/formatters/junit_formatter.rb +51 -32
- data/lib/teaspoon/formatters/modules/report_module.rb +76 -0
- data/lib/teaspoon/formatters/pride_formatter.rb +23 -27
- data/lib/teaspoon/formatters/snowday_formatter.rb +7 -11
- data/lib/teaspoon/formatters/swayze_or_oprah_formatter.rb +88 -64
- data/lib/teaspoon/formatters/tap_formatter.rb +18 -27
- data/lib/teaspoon/formatters/tap_y_formatter.rb +35 -45
- data/lib/teaspoon/formatters/teamcity_formatter.rb +69 -31
- data/lib/teaspoon/instrumentation.rb +33 -33
- data/lib/teaspoon/result.rb +2 -1
- data/lib/teaspoon/runner.rb +40 -28
- data/lib/teaspoon/server.rb +23 -25
- data/lib/teaspoon/suite.rb +52 -72
- data/lib/teaspoon/utility.rb +3 -14
- data/lib/teaspoon/version.rb +1 -1
- data/spec/dummy/app/assets/javascripts/integration/integration_spec.coffee +3 -0
- data/spec/dummy/app/assets/javascripts/integration/spec_helper.coffee +2 -0
- data/spec/dummy/config/application.rb +3 -0
- data/spec/features/console_reporter_spec.rb +48 -18
- data/spec/features/hooks_spec.rb +23 -41
- data/spec/features/html_reporter_spec.rb +38 -21
- data/spec/features/install_generator_spec.rb +34 -20
- data/spec/features/instrumentation_spec.rb +3 -2
- data/spec/fixtures/coverage.json +243 -0
- data/spec/javascripts/fixtures/_body.html.erb +1 -0
- data/spec/javascripts/jasmine_helper.coffee +1 -1
- data/spec/javascripts/teaspoon/base/fixture_spec.coffee +4 -4
- data/spec/javascripts/teaspoon/base/reporters/html_spec.coffee +9 -10
- data/spec/javascripts/teaspoon/mocha/reporters/html_mspec.coffee +0 -6
- data/spec/javascripts/teaspoon/phantomjs/runner_spec.coffee +5 -6
- data/spec/javascripts/turbolinks_helper.coffee +1 -1
- data/spec/spec_helper.rb +3 -4
- data/spec/teaspoon/command_line_spec.rb +139 -23
- data/spec/teaspoon/configuration_spec.rb +164 -46
- data/spec/teaspoon/console_spec.rb +142 -47
- data/spec/teaspoon/coverage_spec.rb +98 -28
- data/spec/teaspoon/drivers/base_spec.rb +5 -0
- data/spec/teaspoon/drivers/phantomjs_driver_spec.rb +32 -14
- data/spec/teaspoon/drivers/selenium_driver_spec.rb +32 -24
- data/spec/teaspoon/engine_spec.rb +8 -5
- data/spec/teaspoon/environment_spec.rb +56 -33
- data/spec/teaspoon/exceptions_spec.rb +57 -0
- data/spec/teaspoon/exporter_spec.rb +96 -0
- data/spec/teaspoon/formatters/base_spec.rb +259 -0
- data/spec/teaspoon/formatters/clean_formatter_spec.rb +37 -0
- data/spec/teaspoon/formatters/documentation_formatter_spec.rb +127 -0
- data/spec/teaspoon/formatters/dot_formatter_spec.rb +52 -56
- data/spec/teaspoon/formatters/json_formatter_spec.rb +77 -0
- data/spec/teaspoon/formatters/junit_formatter_spec.rb +72 -35
- data/spec/teaspoon/formatters/pride_formatter_spec.rb +37 -0
- data/spec/teaspoon/formatters/snowday_formatter_spec.rb +35 -0
- data/spec/teaspoon/formatters/tap_formatter_spec.rb +29 -81
- data/spec/teaspoon/formatters/tap_y_formatter_spec.rb +31 -141
- data/spec/teaspoon/formatters/teamcity_formatter_spec.rb +99 -42
- data/spec/teaspoon/instrumentation_spec.rb +44 -44
- data/spec/teaspoon/result_spec.rb +37 -0
- data/spec/teaspoon/runner_spec.rb +70 -59
- data/spec/teaspoon/server_spec.rb +34 -52
- data/spec/teaspoon/suite_spec.rb +42 -188
- data/spec/teaspoon_env.rb +39 -28
- data/vendor/assets/javascripts/{angular-scenario-1.0.5.js → angular/1.0.5.js} +0 -0
- data/vendor/assets/javascripts/{angular-scenario-1.0.5.MIT-LICENSE → angular/MIT-LICENSE} +0 -0
- data/vendor/assets/javascripts/{jasmine-1.3.1.js → jasmine/1.3.1.js} +0 -0
- data/vendor/assets/javascripts/jasmine/2.0.0.js +2412 -0
- data/vendor/assets/javascripts/{jasmine-1.3.1.MIT.LICENSE → jasmine/MIT.LICENSE} +0 -0
- data/vendor/assets/javascripts/{mocha-1.10.0.js → mocha/1.10.0.js} +1 -0
- data/vendor/assets/javascripts/mocha/1.17.1.js +5813 -0
- data/vendor/assets/javascripts/{mocha-1.10.1.MIT.LICENSE → mocha/MIT.LICENSE} +0 -0
- data/vendor/assets/javascripts/{qunit-1.12.0.js → qunit/1.12.0.js} +1 -1
- data/vendor/assets/javascripts/qunit/1.14.0.js +2288 -0
- data/vendor/assets/javascripts/{qunit-1.12.0.MIT.LICENSE → qunit/MIT.LICENSE} +0 -0
- data/vendor/assets/javascripts/support/chai.js +827 -385
- data/vendor/assets/javascripts/support/jasmine-jquery-1.7.0.js +720 -0
- data/vendor/assets/javascripts/support/jasmine-jquery-2.0.0.js +812 -0
- data/vendor/assets/javascripts/support/sinon-chai.js +17 -0
- data/vendor/assets/javascripts/support/sinon.js +1138 -643
- metadata +57 -36
- data/app/controllers/teaspoon/spec_controller.rb +0 -38
- data/app/helpers/teaspoon/spec_helper.rb +0 -36
- data/app/views/teaspoon/spec/_require_js.html.erb +0 -21
- data/app/views/teaspoon/spec/_standard.html.erb +0 -4
- data/app/views/teaspoon/spec/runner.html.erb +0 -19
- data/lib/generators/teaspoon/install/templates/env.rb +0 -38
- data/lib/generators/teaspoon/install/templates/jasmine/initializer.rb +0 -64
- data/lib/generators/teaspoon/install/templates/mocha/initializer.rb +0 -64
- data/lib/generators/teaspoon/install/templates/qunit/initializer.rb +0 -64
- data/lib/teaspoon/check_coverage.rb +0 -33
- data/lib/teaspoon/drivers/base_driver.rb +0 -10
- data/lib/teaspoon/exception_handling.rb +0 -18
- data/lib/teaspoon/formatters/base_formatter.rb +0 -63
- data/spec/dummy/config/initializers/teaspoon.rb +0 -41
- data/spec/teaspoon/check_coverage_spec.rb +0 -50
- data/spec/teaspoon/formatters/base_formatter_spec.rb +0 -45
- data/vendor/assets/javascripts/support/chai.MIT.LICENSE +0 -22
- data/vendor/assets/javascripts/support/expect.MIT.LICENSE +0 -22
- data/vendor/assets/javascripts/support/jasmine-jquery.MIT.LICENSE +0 -20
- data/vendor/assets/javascripts/support/jasmine-jquery.js +0 -659
- data/vendor/assets/javascripts/support/sinon-chai.MIT-ISH.LICENSE +0 -13
- data/vendor/assets/javascripts/support/sinon.BSD.LICENSE +0 -27
File without changes
|
@@ -27,10 +27,14 @@
|
|
27
27
|
// perform real require()
|
28
28
|
// by invoking the module's
|
29
29
|
// registered function
|
30
|
-
if (!module.exports) {
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
if (!module._resolving && !module.exports) {
|
31
|
+
var mod = {};
|
32
|
+
mod.exports = {};
|
33
|
+
mod.client = mod.component = true;
|
34
|
+
module._resolving = true;
|
35
|
+
module.call(this, mod.exports, require.relative(resolved), mod);
|
36
|
+
delete module._resolving;
|
37
|
+
module.exports = mod.exports;
|
34
38
|
}
|
35
39
|
|
36
40
|
return module.exports;
|
@@ -64,7 +68,6 @@
|
|
64
68
|
|
65
69
|
require.resolve = function(path) {
|
66
70
|
if (path.charAt(0) === '/') path = path.slice(1);
|
67
|
-
var index = path + '/index.js';
|
68
71
|
|
69
72
|
var paths = [
|
70
73
|
path,
|
@@ -77,10 +80,7 @@
|
|
77
80
|
for (var i = 0; i < paths.length; i++) {
|
78
81
|
var path = paths[i];
|
79
82
|
if (require.modules.hasOwnProperty(path)) return path;
|
80
|
-
|
81
|
-
|
82
|
-
if (require.aliases.hasOwnProperty(index)) {
|
83
|
-
return require.aliases[index];
|
83
|
+
if (require.aliases.hasOwnProperty(path)) return require.aliases[path];
|
84
84
|
}
|
85
85
|
};
|
86
86
|
|
@@ -200,287 +200,745 @@
|
|
200
200
|
|
201
201
|
return localRequire;
|
202
202
|
};
|
203
|
-
require.register("
|
204
|
-
module.exports = require('./lib/chai');
|
205
|
-
|
206
|
-
});
|
207
|
-
require.register("chai/lib/chai.js", function(exports, require, module){
|
203
|
+
require.register("chaijs-assertion-error/index.js", function(exports, require, module){
|
208
204
|
/*!
|
209
|
-
*
|
210
|
-
* Copyright(c)
|
205
|
+
* assertion-error
|
206
|
+
* Copyright(c) 2013 Jake Luer <jake@qualiancy.com>
|
211
207
|
* MIT Licensed
|
212
208
|
*/
|
213
209
|
|
214
|
-
|
215
|
-
|
210
|
+
/*!
|
211
|
+
* Return a function that will copy properties from
|
212
|
+
* one object to another excluding any originally
|
213
|
+
* listed. Returned function will create a new `{}`.
|
214
|
+
*
|
215
|
+
* @param {String} excluded properties ...
|
216
|
+
* @return {Function}
|
217
|
+
*/
|
218
|
+
|
219
|
+
function exclude () {
|
220
|
+
var excludes = [].slice.call(arguments);
|
221
|
+
|
222
|
+
function excludeProps (res, obj) {
|
223
|
+
Object.keys(obj).forEach(function (key) {
|
224
|
+
if (!~excludes.indexOf(key)) res[key] = obj[key];
|
225
|
+
});
|
226
|
+
}
|
227
|
+
|
228
|
+
return function extendExclude () {
|
229
|
+
var args = [].slice.call(arguments)
|
230
|
+
, i = 0
|
231
|
+
, res = {};
|
232
|
+
|
233
|
+
for (; i < args.length; i++) {
|
234
|
+
excludeProps(res, args[i]);
|
235
|
+
}
|
236
|
+
|
237
|
+
return res;
|
238
|
+
};
|
239
|
+
};
|
216
240
|
|
217
241
|
/*!
|
218
|
-
*
|
242
|
+
* Primary Exports
|
243
|
+
*/
|
244
|
+
|
245
|
+
module.exports = AssertionError;
|
246
|
+
|
247
|
+
/**
|
248
|
+
* ### AssertionError
|
249
|
+
*
|
250
|
+
* An extension of the JavaScript `Error` constructor for
|
251
|
+
* assertion and validation scenarios.
|
252
|
+
*
|
253
|
+
* @param {String} message
|
254
|
+
* @param {Object} properties to include (optional)
|
255
|
+
* @param {callee} start stack function (optional)
|
219
256
|
*/
|
220
257
|
|
221
|
-
|
258
|
+
function AssertionError (message, _props, ssf) {
|
259
|
+
var extend = exclude('name', 'message', 'stack', 'constructor', 'toJSON')
|
260
|
+
, props = extend(_props || {});
|
261
|
+
|
262
|
+
// default values
|
263
|
+
this.message = message || 'Unspecified AssertionError';
|
264
|
+
this.showDiff = false;
|
265
|
+
|
266
|
+
// copy from properties
|
267
|
+
for (var key in props) {
|
268
|
+
this[key] = props[key];
|
269
|
+
}
|
270
|
+
|
271
|
+
// capture stack trace
|
272
|
+
ssf = ssf || arguments.callee;
|
273
|
+
if (ssf && Error.captureStackTrace) {
|
274
|
+
Error.captureStackTrace(this, ssf);
|
275
|
+
}
|
276
|
+
}
|
222
277
|
|
223
278
|
/*!
|
224
|
-
*
|
279
|
+
* Inherit from Error.prototype
|
225
280
|
*/
|
226
281
|
|
227
|
-
|
282
|
+
AssertionError.prototype = Object.create(Error.prototype);
|
228
283
|
|
229
284
|
/*!
|
230
|
-
*
|
285
|
+
* Statically set name
|
231
286
|
*/
|
232
287
|
|
233
|
-
|
288
|
+
AssertionError.prototype.name = 'AssertionError';
|
234
289
|
|
235
290
|
/*!
|
236
|
-
*
|
291
|
+
* Ensure correct constructor
|
237
292
|
*/
|
238
293
|
|
239
|
-
|
294
|
+
AssertionError.prototype.constructor = AssertionError;
|
240
295
|
|
241
296
|
/**
|
242
|
-
*
|
243
|
-
*
|
244
|
-
* Provides a way to extend the internals of Chai
|
297
|
+
* Allow errors to be converted to JSON for static transfer.
|
245
298
|
*
|
246
|
-
* @param {
|
247
|
-
* @
|
248
|
-
* @api public
|
299
|
+
* @param {Boolean} include stack (default: `true`)
|
300
|
+
* @return {Object} object that can be `JSON.stringify`
|
249
301
|
*/
|
250
302
|
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
303
|
+
AssertionError.prototype.toJSON = function (stack) {
|
304
|
+
var extend = exclude('constructor', 'toJSON', 'stack')
|
305
|
+
, props = extend({ name: this.name }, this);
|
306
|
+
|
307
|
+
// include stack if exists and not turned off
|
308
|
+
if (false !== stack && this.stack) {
|
309
|
+
props.stack = this.stack;
|
255
310
|
}
|
256
311
|
|
257
|
-
return
|
312
|
+
return props;
|
258
313
|
};
|
259
314
|
|
315
|
+
});
|
316
|
+
require.register("chaijs-type-detect/lib/type.js", function(exports, require, module){
|
260
317
|
/*!
|
261
|
-
*
|
318
|
+
* type-detect
|
319
|
+
* Copyright(c) 2013 jake luer <jake@alogicalparadox.com>
|
320
|
+
* MIT Licensed
|
262
321
|
*/
|
263
322
|
|
264
|
-
var core = require('./chai/core/assertions');
|
265
|
-
exports.use(core);
|
266
|
-
|
267
323
|
/*!
|
268
|
-
*
|
324
|
+
* Primary Exports
|
269
325
|
*/
|
270
326
|
|
271
|
-
var
|
272
|
-
exports.use(expect);
|
327
|
+
var exports = module.exports = getType;
|
273
328
|
|
274
329
|
/*!
|
275
|
-
*
|
330
|
+
* Detectable javascript natives
|
276
331
|
*/
|
277
332
|
|
278
|
-
var
|
279
|
-
|
333
|
+
var natives = {
|
334
|
+
'[object Array]': 'array'
|
335
|
+
, '[object RegExp]': 'regexp'
|
336
|
+
, '[object Function]': 'function'
|
337
|
+
, '[object Arguments]': 'arguments'
|
338
|
+
, '[object Date]': 'date'
|
339
|
+
};
|
280
340
|
|
281
|
-
|
282
|
-
*
|
341
|
+
/**
|
342
|
+
* ### typeOf (obj)
|
343
|
+
*
|
344
|
+
* Use several different techniques to determine
|
345
|
+
* the type of object being tested.
|
346
|
+
*
|
347
|
+
*
|
348
|
+
* @param {Mixed} object
|
349
|
+
* @return {String} object type
|
350
|
+
* @api public
|
283
351
|
*/
|
284
352
|
|
285
|
-
|
286
|
-
|
353
|
+
function getType (obj) {
|
354
|
+
var str = Object.prototype.toString.call(obj);
|
355
|
+
if (natives[str]) return natives[str];
|
356
|
+
if (obj === null) return 'null';
|
357
|
+
if (obj === undefined) return 'undefined';
|
358
|
+
if (obj === Object(obj)) return 'object';
|
359
|
+
return typeof obj;
|
360
|
+
}
|
361
|
+
|
362
|
+
exports.Library = Library;
|
363
|
+
|
364
|
+
/**
|
365
|
+
* ### Library
|
366
|
+
*
|
367
|
+
* Create a repository for custom type detection.
|
368
|
+
*
|
369
|
+
* ```js
|
370
|
+
* var lib = new type.Library;
|
371
|
+
* ```
|
372
|
+
*
|
373
|
+
*/
|
374
|
+
|
375
|
+
function Library () {
|
376
|
+
this.tests = {};
|
377
|
+
}
|
378
|
+
|
379
|
+
/**
|
380
|
+
* #### .of (obj)
|
381
|
+
*
|
382
|
+
* Expose replacement `typeof` detection to the library.
|
383
|
+
*
|
384
|
+
* ```js
|
385
|
+
* if ('string' === lib.of('hello world')) {
|
386
|
+
* // ...
|
387
|
+
* }
|
388
|
+
* ```
|
389
|
+
*
|
390
|
+
* @param {Mixed} object to test
|
391
|
+
* @return {String} type
|
392
|
+
*/
|
393
|
+
|
394
|
+
Library.prototype.of = getType;
|
395
|
+
|
396
|
+
/**
|
397
|
+
* #### .define (type, test)
|
398
|
+
*
|
399
|
+
* Add a test to for the `.test()` assertion.
|
400
|
+
*
|
401
|
+
* Can be defined as a regular expression:
|
402
|
+
*
|
403
|
+
* ```js
|
404
|
+
* lib.define('int', /^[0-9]+$/);
|
405
|
+
* ```
|
406
|
+
*
|
407
|
+
* ... or as a function:
|
408
|
+
*
|
409
|
+
* ```js
|
410
|
+
* lib.define('bln', function (obj) {
|
411
|
+
* if ('boolean' === lib.of(obj)) return true;
|
412
|
+
* var blns = [ 'yes', 'no', 'true', 'false', 1, 0 ];
|
413
|
+
* if ('string' === lib.of(obj)) obj = obj.toLowerCase();
|
414
|
+
* return !! ~blns.indexOf(obj);
|
415
|
+
* });
|
416
|
+
* ```
|
417
|
+
*
|
418
|
+
* @param {String} type
|
419
|
+
* @param {RegExp|Function} test
|
420
|
+
* @api public
|
421
|
+
*/
|
422
|
+
|
423
|
+
Library.prototype.define = function (type, test) {
|
424
|
+
if (arguments.length === 1) return this.tests[type];
|
425
|
+
this.tests[type] = test;
|
426
|
+
return this;
|
427
|
+
};
|
428
|
+
|
429
|
+
/**
|
430
|
+
* #### .test (obj, test)
|
431
|
+
*
|
432
|
+
* Assert that an object is of type. Will first
|
433
|
+
* check natives, and if that does not pass it will
|
434
|
+
* use the user defined custom tests.
|
435
|
+
*
|
436
|
+
* ```js
|
437
|
+
* assert(lib.test('1', 'int'));
|
438
|
+
* assert(lib.test('yes', 'bln'));
|
439
|
+
* ```
|
440
|
+
*
|
441
|
+
* @param {Mixed} object
|
442
|
+
* @param {String} type
|
443
|
+
* @return {Boolean} result
|
444
|
+
* @api public
|
445
|
+
*/
|
446
|
+
|
447
|
+
Library.prototype.test = function (obj, type) {
|
448
|
+
if (type === getType(obj)) return true;
|
449
|
+
var test = this.tests[type];
|
450
|
+
|
451
|
+
if (test && 'regexp' === getType(test)) {
|
452
|
+
return test.test(obj);
|
453
|
+
} else if (test && 'function' === getType(test)) {
|
454
|
+
return test(obj);
|
455
|
+
} else {
|
456
|
+
throw new ReferenceError('Type test "' + type + '" not defined or invalid.');
|
457
|
+
}
|
458
|
+
};
|
287
459
|
|
288
460
|
});
|
289
|
-
require.register("
|
461
|
+
require.register("chaijs-deep-eql/lib/eql.js", function(exports, require, module){
|
290
462
|
/*!
|
291
|
-
*
|
292
|
-
*
|
293
|
-
* Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>
|
463
|
+
* deep-eql
|
464
|
+
* Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>
|
294
465
|
* MIT Licensed
|
295
466
|
*/
|
296
467
|
|
297
468
|
/*!
|
298
|
-
* Module dependencies
|
469
|
+
* Module dependencies
|
299
470
|
*/
|
300
471
|
|
301
|
-
var
|
302
|
-
, util = require('./utils')
|
303
|
-
, flag = util.flag;
|
472
|
+
var type = require('type-detect');
|
304
473
|
|
305
474
|
/*!
|
306
|
-
*
|
475
|
+
* Buffer.isBuffer browser shim
|
307
476
|
*/
|
308
477
|
|
309
|
-
|
310
|
-
|
478
|
+
var Buffer;
|
479
|
+
try { Buffer = require('buffer').Buffer; }
|
480
|
+
catch(ex) {
|
481
|
+
Buffer = {};
|
482
|
+
Buffer.isBuffer = function() { return false; }
|
483
|
+
}
|
311
484
|
|
312
485
|
/*!
|
313
|
-
*
|
486
|
+
* Primary Export
|
487
|
+
*/
|
488
|
+
|
489
|
+
module.exports = deepEqual;
|
490
|
+
|
491
|
+
/**
|
492
|
+
* Assert super-strict (egal) equality between
|
493
|
+
* two objects of any type.
|
314
494
|
*
|
315
|
-
*
|
495
|
+
* @param {Mixed} a
|
496
|
+
* @param {Mixed} b
|
497
|
+
* @param {Array} memoised (optional)
|
498
|
+
* @return {Boolean} equal match
|
499
|
+
*/
|
500
|
+
|
501
|
+
function deepEqual(a, b, m) {
|
502
|
+
if (sameValue(a, b)) {
|
503
|
+
return true;
|
504
|
+
} else if ('date' === type(a)) {
|
505
|
+
return dateEqual(a, b);
|
506
|
+
} else if ('regexp' === type(a)) {
|
507
|
+
return regexpEqual(a, b);
|
508
|
+
} else if (Buffer.isBuffer(a)) {
|
509
|
+
return bufferEqual(a, b);
|
510
|
+
} else if ('arguments' === type(a)) {
|
511
|
+
return argumentsEqual(a, b, m);
|
512
|
+
} else if (!typeEqual(a, b)) {
|
513
|
+
return false;
|
514
|
+
} else if (('object' !== type(a) && 'object' !== type(b))
|
515
|
+
&& ('array' !== type(a) && 'array' !== type(b))) {
|
516
|
+
return sameValue(a, b);
|
517
|
+
} else {
|
518
|
+
return objectEqual(a, b, m);
|
519
|
+
}
|
520
|
+
}
|
521
|
+
|
522
|
+
/*!
|
523
|
+
* Strict (egal) equality test. Ensures that NaN always
|
524
|
+
* equals NaN and `-0` does not equal `+0`.
|
316
525
|
*
|
317
|
-
* @
|
526
|
+
* @param {Mixed} a
|
527
|
+
* @param {Mixed} b
|
528
|
+
* @return {Boolean} equal match
|
318
529
|
*/
|
319
530
|
|
320
|
-
function
|
321
|
-
|
322
|
-
|
323
|
-
flag(this, 'message', msg);
|
531
|
+
function sameValue(a, b) {
|
532
|
+
if (a === b) return a !== 0 || 1 / a === 1 / b;
|
533
|
+
return a !== a && b !== b;
|
324
534
|
}
|
325
535
|
|
326
536
|
/*!
|
327
|
-
*
|
537
|
+
* Compare the types of two given objects and
|
538
|
+
* return if they are equal. Note that an Array
|
539
|
+
* has a type of `array` (not `object`) and arguments
|
540
|
+
* have a type of `arguments` (not `array`/`object`).
|
328
541
|
*
|
329
|
-
*
|
330
|
-
*
|
331
|
-
*
|
542
|
+
* @param {Mixed} a
|
543
|
+
* @param {Mixed} b
|
544
|
+
* @return {Boolean} result
|
545
|
+
*/
|
546
|
+
|
547
|
+
function typeEqual(a, b) {
|
548
|
+
return type(a) === type(b);
|
549
|
+
}
|
550
|
+
|
551
|
+
/*!
|
552
|
+
* Compare two Date objects by asserting that
|
553
|
+
* the time values are equal using `saveValue`.
|
332
554
|
*
|
333
|
-
*
|
555
|
+
* @param {Date} a
|
556
|
+
* @param {Date} b
|
557
|
+
* @return {Boolean} result
|
558
|
+
*/
|
559
|
+
|
560
|
+
function dateEqual(a, b) {
|
561
|
+
if ('date' !== type(b)) return false;
|
562
|
+
return sameValue(a.getTime(), b.getTime());
|
563
|
+
}
|
564
|
+
|
565
|
+
/*!
|
566
|
+
* Compare two regular expressions by converting them
|
567
|
+
* to string and checking for `sameValue`.
|
334
568
|
*
|
335
|
-
* @
|
569
|
+
* @param {RegExp} a
|
570
|
+
* @param {RegExp} b
|
571
|
+
* @return {Boolean} result
|
336
572
|
*/
|
337
573
|
|
338
|
-
|
574
|
+
function regexpEqual(a, b) {
|
575
|
+
if ('regexp' !== type(b)) return false;
|
576
|
+
return sameValue(a.toString(), b.toString());
|
577
|
+
}
|
339
578
|
|
340
579
|
/*!
|
341
|
-
*
|
580
|
+
* Assert deep equality of two `arguments` objects.
|
581
|
+
* Unfortunately, these must be sliced to arrays
|
582
|
+
* prior to test to ensure no bad behavior.
|
342
583
|
*
|
343
|
-
*
|
344
|
-
*
|
345
|
-
*
|
346
|
-
*
|
347
|
-
|
584
|
+
* @param {Arguments} a
|
585
|
+
* @param {Arguments} b
|
586
|
+
* @param {Array} memoize (optional)
|
587
|
+
* @return {Boolean} result
|
588
|
+
*/
|
589
|
+
|
590
|
+
function argumentsEqual(a, b, m) {
|
591
|
+
if ('arguments' !== type(b)) return false;
|
592
|
+
a = [].slice.call(a);
|
593
|
+
b = [].slice.call(b);
|
594
|
+
return deepEqual(a, b, m);
|
595
|
+
}
|
596
|
+
|
597
|
+
/*!
|
598
|
+
* Get enumerable properties of a given object.
|
348
599
|
*
|
349
|
-
* @
|
600
|
+
* @param {Object} a
|
601
|
+
* @return {Array} property names
|
350
602
|
*/
|
351
603
|
|
352
|
-
|
604
|
+
function enumerable(a) {
|
605
|
+
var res = [];
|
606
|
+
for (var key in a) res.push(key);
|
607
|
+
return res;
|
608
|
+
}
|
353
609
|
|
354
|
-
|
355
|
-
|
356
|
-
|
610
|
+
/*!
|
611
|
+
* Simple equality for flat iterable objects
|
612
|
+
* such as Arrays or Node.js buffers.
|
613
|
+
*
|
614
|
+
* @param {Iterable} a
|
615
|
+
* @param {Iterable} b
|
616
|
+
* @return {Boolean} result
|
617
|
+
*/
|
357
618
|
|
358
|
-
|
359
|
-
|
360
|
-
};
|
619
|
+
function iterableEqual(a, b) {
|
620
|
+
if (a.length !== b.length) return false;
|
361
621
|
|
362
|
-
|
363
|
-
|
364
|
-
};
|
622
|
+
var i = 0;
|
623
|
+
var match = true;
|
365
624
|
|
366
|
-
|
367
|
-
|
368
|
-
|
625
|
+
for (; i < a.length; i++) {
|
626
|
+
if (a[i] !== b[i]) {
|
627
|
+
match = false;
|
628
|
+
break;
|
629
|
+
}
|
630
|
+
}
|
369
631
|
|
370
|
-
|
371
|
-
|
372
|
-
};
|
632
|
+
return match;
|
633
|
+
}
|
373
634
|
|
374
635
|
/*!
|
375
|
-
*
|
636
|
+
* Extension to `iterableEqual` specifically
|
637
|
+
* for Node.js Buffers.
|
376
638
|
*
|
377
|
-
*
|
378
|
-
*
|
379
|
-
* @
|
380
|
-
* @param {Philosophical} expression to be tested
|
381
|
-
* @param {String} message to display if fails
|
382
|
-
* @param {String} negatedMessage to display if negated expression fails
|
383
|
-
* @param {Mixed} expected value (remember to check for negation)
|
384
|
-
* @param {Mixed} actual (optional) will default to `this.obj`
|
385
|
-
* @api private
|
639
|
+
* @param {Buffer} a
|
640
|
+
* @param {Mixed} b
|
641
|
+
* @return {Boolean} result
|
386
642
|
*/
|
387
643
|
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
if (!ok) {
|
394
|
-
var msg = util.getMessage(this, arguments)
|
395
|
-
, actual = util.getActual(this, arguments);
|
396
|
-
throw new AssertionError({
|
397
|
-
message: msg
|
398
|
-
, actual: actual
|
399
|
-
, expected: expected
|
400
|
-
, stackStartFunction: (Assertion.includeStack) ? this.assert : flag(this, 'ssfi')
|
401
|
-
, showDiff: showDiff
|
402
|
-
});
|
403
|
-
}
|
404
|
-
};
|
644
|
+
function bufferEqual(a, b) {
|
645
|
+
if (!Buffer.isBuffer(b)) return false;
|
646
|
+
return iterableEqual(a, b);
|
647
|
+
}
|
405
648
|
|
406
649
|
/*!
|
407
|
-
*
|
650
|
+
* Block for `objectEqual` ensuring non-existing
|
651
|
+
* values don't get in.
|
408
652
|
*
|
409
|
-
*
|
653
|
+
* @param {Mixed} object
|
654
|
+
* @return {Boolean} result
|
655
|
+
*/
|
656
|
+
|
657
|
+
function isValue(a) {
|
658
|
+
return a !== null && a !== undefined;
|
659
|
+
}
|
660
|
+
|
661
|
+
/*!
|
662
|
+
* Recursively check the equality of two objects.
|
663
|
+
* Once basic sameness has been established it will
|
664
|
+
* defer to `deepEqual` for each enumerable key
|
665
|
+
* in the object.
|
410
666
|
*
|
411
|
-
* @
|
667
|
+
* @param {Mixed} a
|
668
|
+
* @param {Mixed} b
|
669
|
+
* @return {Boolean} result
|
412
670
|
*/
|
413
671
|
|
414
|
-
|
415
|
-
|
416
|
-
|
672
|
+
function objectEqual(a, b, m) {
|
673
|
+
if (!isValue(a) || !isValue(b)) {
|
674
|
+
return false;
|
675
|
+
}
|
676
|
+
|
677
|
+
if (a.prototype !== b.prototype) {
|
678
|
+
return false;
|
679
|
+
}
|
680
|
+
|
681
|
+
var i;
|
682
|
+
if (m) {
|
683
|
+
for (i = 0; i < m.length; i++) {
|
684
|
+
if ((m[i][0] === a && m[i][1] === b)
|
685
|
+
|| (m[i][0] === b && m[i][1] === a)) {
|
686
|
+
return true;
|
687
|
+
}
|
417
688
|
}
|
418
|
-
|
419
|
-
|
689
|
+
} else {
|
690
|
+
m = [];
|
691
|
+
}
|
692
|
+
|
693
|
+
try {
|
694
|
+
var ka = enumerable(a);
|
695
|
+
var kb = enumerable(b);
|
696
|
+
} catch (ex) {
|
697
|
+
return false;
|
698
|
+
}
|
699
|
+
|
700
|
+
ka.sort();
|
701
|
+
kb.sort();
|
702
|
+
|
703
|
+
if (!iterableEqual(ka, kb)) {
|
704
|
+
return false;
|
705
|
+
}
|
706
|
+
|
707
|
+
m.push([ a, b ]);
|
708
|
+
|
709
|
+
var key;
|
710
|
+
for (i = ka.length - 1; i >= 0; i--) {
|
711
|
+
key = ka[i];
|
712
|
+
if (!deepEqual(a[key], b[key], m)) {
|
713
|
+
return false;
|
420
714
|
}
|
421
|
-
|
715
|
+
}
|
716
|
+
|
717
|
+
return true;
|
718
|
+
}
|
719
|
+
|
720
|
+
});
|
721
|
+
require.register("chai/index.js", function(exports, require, module){
|
722
|
+
module.exports = require('./lib/chai');
|
422
723
|
|
423
724
|
});
|
424
|
-
require.register("chai/lib/chai
|
725
|
+
require.register("chai/lib/chai.js", function(exports, require, module){
|
425
726
|
/*!
|
426
727
|
* chai
|
427
|
-
* Copyright(c) 2011-
|
728
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
428
729
|
* MIT Licensed
|
429
730
|
*/
|
430
731
|
|
732
|
+
var used = []
|
733
|
+
, exports = module.exports = {};
|
734
|
+
|
431
735
|
/*!
|
432
|
-
*
|
736
|
+
* Chai version
|
433
737
|
*/
|
434
738
|
|
435
|
-
|
739
|
+
exports.version = '1.8.1';
|
740
|
+
|
741
|
+
/*!
|
742
|
+
* Assertion Error
|
743
|
+
*/
|
744
|
+
|
745
|
+
exports.AssertionError = require('assertion-error');
|
746
|
+
|
747
|
+
/*!
|
748
|
+
* Utils for plugins (not exported)
|
749
|
+
*/
|
750
|
+
|
751
|
+
var util = require('./chai/utils');
|
436
752
|
|
437
753
|
/**
|
438
|
-
* #
|
439
|
-
*
|
440
|
-
* Create a new assertion error based on the Javascript
|
441
|
-
* `Error` prototype.
|
754
|
+
* # .use(function)
|
442
755
|
*
|
443
|
-
*
|
444
|
-
* - message
|
445
|
-
* - actual
|
446
|
-
* - expected
|
447
|
-
* - operator
|
448
|
-
* - startStackFunction
|
756
|
+
* Provides a way to extend the internals of Chai
|
449
757
|
*
|
450
|
-
* @param {
|
758
|
+
* @param {Function}
|
759
|
+
* @returns {this} for chaining
|
451
760
|
* @api public
|
452
761
|
*/
|
453
762
|
|
454
|
-
function
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
this.expected = options.expected;
|
459
|
-
this.operator = options.operator;
|
460
|
-
this.showDiff = options.showDiff;
|
461
|
-
|
462
|
-
if (options.stackStartFunction && Error.captureStackTrace) {
|
463
|
-
var stackStartFunction = options.stackStartFunction;
|
464
|
-
Error.captureStackTrace(this, stackStartFunction);
|
763
|
+
exports.use = function (fn) {
|
764
|
+
if (!~used.indexOf(fn)) {
|
765
|
+
fn(this, util);
|
766
|
+
used.push(fn);
|
465
767
|
}
|
466
|
-
|
768
|
+
|
769
|
+
return this;
|
770
|
+
};
|
467
771
|
|
468
772
|
/*!
|
469
|
-
*
|
773
|
+
* Primary `Assertion` prototype
|
470
774
|
*/
|
471
775
|
|
472
|
-
|
473
|
-
|
474
|
-
AssertionError.prototype.constructor = AssertionError;
|
776
|
+
var assertion = require('./chai/assertion');
|
777
|
+
exports.use(assertion);
|
475
778
|
|
476
|
-
|
477
|
-
*
|
478
|
-
|
479
|
-
|
779
|
+
/*!
|
780
|
+
* Core Assertions
|
781
|
+
*/
|
782
|
+
|
783
|
+
var core = require('./chai/core/assertions');
|
784
|
+
exports.use(core);
|
785
|
+
|
786
|
+
/*!
|
787
|
+
* Expect interface
|
788
|
+
*/
|
789
|
+
|
790
|
+
var expect = require('./chai/interface/expect');
|
791
|
+
exports.use(expect);
|
792
|
+
|
793
|
+
/*!
|
794
|
+
* Should interface
|
795
|
+
*/
|
796
|
+
|
797
|
+
var should = require('./chai/interface/should');
|
798
|
+
exports.use(should);
|
799
|
+
|
800
|
+
/*!
|
801
|
+
* Assert interface
|
480
802
|
*/
|
481
803
|
|
482
|
-
|
483
|
-
|
804
|
+
var assert = require('./chai/interface/assert');
|
805
|
+
exports.use(assert);
|
806
|
+
|
807
|
+
});
|
808
|
+
require.register("chai/lib/chai/assertion.js", function(exports, require, module){
|
809
|
+
/*!
|
810
|
+
* chai
|
811
|
+
* http://chaijs.com
|
812
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
813
|
+
* MIT Licensed
|
814
|
+
*/
|
815
|
+
|
816
|
+
module.exports = function (_chai, util) {
|
817
|
+
/*!
|
818
|
+
* Module dependencies.
|
819
|
+
*/
|
820
|
+
|
821
|
+
var AssertionError = _chai.AssertionError
|
822
|
+
, flag = util.flag;
|
823
|
+
|
824
|
+
/*!
|
825
|
+
* Module export.
|
826
|
+
*/
|
827
|
+
|
828
|
+
_chai.Assertion = Assertion;
|
829
|
+
|
830
|
+
/*!
|
831
|
+
* Assertion Constructor
|
832
|
+
*
|
833
|
+
* Creates object for chaining.
|
834
|
+
*
|
835
|
+
* @api private
|
836
|
+
*/
|
837
|
+
|
838
|
+
function Assertion (obj, msg, stack) {
|
839
|
+
flag(this, 'ssfi', stack || arguments.callee);
|
840
|
+
flag(this, 'object', obj);
|
841
|
+
flag(this, 'message', msg);
|
842
|
+
}
|
843
|
+
|
844
|
+
/*!
|
845
|
+
* ### Assertion.includeStack
|
846
|
+
*
|
847
|
+
* User configurable property, influences whether stack trace
|
848
|
+
* is included in Assertion error message. Default of false
|
849
|
+
* suppresses stack trace in the error message
|
850
|
+
*
|
851
|
+
* Assertion.includeStack = true; // enable stack on error
|
852
|
+
*
|
853
|
+
* @api public
|
854
|
+
*/
|
855
|
+
|
856
|
+
Assertion.includeStack = false;
|
857
|
+
|
858
|
+
/*!
|
859
|
+
* ### Assertion.showDiff
|
860
|
+
*
|
861
|
+
* User configurable property, influences whether or not
|
862
|
+
* the `showDiff` flag should be included in the thrown
|
863
|
+
* AssertionErrors. `false` will always be `false`; `true`
|
864
|
+
* will be true when the assertion has requested a diff
|
865
|
+
* be shown.
|
866
|
+
*
|
867
|
+
* @api public
|
868
|
+
*/
|
869
|
+
|
870
|
+
Assertion.showDiff = true;
|
871
|
+
|
872
|
+
Assertion.addProperty = function (name, fn) {
|
873
|
+
util.addProperty(this.prototype, name, fn);
|
874
|
+
};
|
875
|
+
|
876
|
+
Assertion.addMethod = function (name, fn) {
|
877
|
+
util.addMethod(this.prototype, name, fn);
|
878
|
+
};
|
879
|
+
|
880
|
+
Assertion.addChainableMethod = function (name, fn, chainingBehavior) {
|
881
|
+
util.addChainableMethod(this.prototype, name, fn, chainingBehavior);
|
882
|
+
};
|
883
|
+
|
884
|
+
Assertion.overwriteProperty = function (name, fn) {
|
885
|
+
util.overwriteProperty(this.prototype, name, fn);
|
886
|
+
};
|
887
|
+
|
888
|
+
Assertion.overwriteMethod = function (name, fn) {
|
889
|
+
util.overwriteMethod(this.prototype, name, fn);
|
890
|
+
};
|
891
|
+
|
892
|
+
Assertion.overwriteChainableMethod = function (name, fn, chainingBehavior) {
|
893
|
+
util.overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);
|
894
|
+
};
|
895
|
+
|
896
|
+
/*!
|
897
|
+
* ### .assert(expression, message, negateMessage, expected, actual)
|
898
|
+
*
|
899
|
+
* Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass.
|
900
|
+
*
|
901
|
+
* @name assert
|
902
|
+
* @param {Philosophical} expression to be tested
|
903
|
+
* @param {String} message to display if fails
|
904
|
+
* @param {String} negatedMessage to display if negated expression fails
|
905
|
+
* @param {Mixed} expected value (remember to check for negation)
|
906
|
+
* @param {Mixed} actual (optional) will default to `this.obj`
|
907
|
+
* @api private
|
908
|
+
*/
|
909
|
+
|
910
|
+
Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) {
|
911
|
+
var ok = util.test(this, arguments);
|
912
|
+
if (true !== showDiff) showDiff = false;
|
913
|
+
if (true !== Assertion.showDiff) showDiff = false;
|
914
|
+
|
915
|
+
if (!ok) {
|
916
|
+
var msg = util.getMessage(this, arguments)
|
917
|
+
, actual = util.getActual(this, arguments);
|
918
|
+
throw new AssertionError(msg, {
|
919
|
+
actual: actual
|
920
|
+
, expected: expected
|
921
|
+
, showDiff: showDiff
|
922
|
+
}, (Assertion.includeStack) ? this.assert : flag(this, 'ssfi'));
|
923
|
+
}
|
924
|
+
};
|
925
|
+
|
926
|
+
/*!
|
927
|
+
* ### ._obj
|
928
|
+
*
|
929
|
+
* Quick reference to stored `actual` value for plugin developers.
|
930
|
+
*
|
931
|
+
* @api private
|
932
|
+
*/
|
933
|
+
|
934
|
+
Object.defineProperty(Assertion.prototype, '_obj',
|
935
|
+
{ get: function () {
|
936
|
+
return flag(this, 'object');
|
937
|
+
}
|
938
|
+
, set: function (val) {
|
939
|
+
flag(this, 'object', val);
|
940
|
+
}
|
941
|
+
});
|
484
942
|
};
|
485
943
|
|
486
944
|
});
|
@@ -488,7 +946,7 @@
|
|
488
946
|
/*!
|
489
947
|
* chai
|
490
948
|
* http://chaijs.com
|
491
|
-
* Copyright(c) 2011-
|
949
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
492
950
|
* MIT Licensed
|
493
951
|
*/
|
494
952
|
|
@@ -500,7 +958,7 @@
|
|
500
958
|
/**
|
501
959
|
* ### Language Chains
|
502
960
|
*
|
503
|
-
* The following are
|
961
|
+
* The following are provided as chainable getters to
|
504
962
|
* improve the readability of your assertions. They
|
505
963
|
* do not provide an testing capability unless they
|
506
964
|
* have been overwritten by a plugin.
|
@@ -513,6 +971,7 @@
|
|
513
971
|
* - is
|
514
972
|
* - that
|
515
973
|
* - and
|
974
|
+
* - has
|
516
975
|
* - have
|
517
976
|
* - with
|
518
977
|
* - at
|
@@ -524,7 +983,7 @@
|
|
524
983
|
*/
|
525
984
|
|
526
985
|
[ 'to', 'be', 'been'
|
527
|
-
, 'is', 'and', 'have'
|
986
|
+
, 'is', 'and', 'has', 'have'
|
528
987
|
, 'with', 'that', 'at'
|
529
988
|
, 'of', 'same' ].forEach(function (chain) {
|
530
989
|
Assertion.addProperty(chain, function () {
|
@@ -632,9 +1091,21 @@
|
|
632
1091
|
|
633
1092
|
function include (val, msg) {
|
634
1093
|
if (msg) flag(this, 'message', msg);
|
635
|
-
var obj = flag(this, 'object')
|
1094
|
+
var obj = flag(this, 'object');
|
1095
|
+
|
1096
|
+
if (_.type(val) === 'object') {
|
1097
|
+
if (!flag(this, 'negate')) {
|
1098
|
+
for (var k in val) new Assertion(obj).property(k, val[k]);
|
1099
|
+
return;
|
1100
|
+
}
|
1101
|
+
var subset = {}
|
1102
|
+
for (var k in val) subset[k] = obj[k]
|
1103
|
+
var expected = _.eql(subset, val);
|
1104
|
+
} else {
|
1105
|
+
var expected = obj && ~obj.indexOf(val)
|
1106
|
+
}
|
636
1107
|
this.assert(
|
637
|
-
|
1108
|
+
expected
|
638
1109
|
, 'expected #{this} to include ' + _.inspect(val)
|
639
1110
|
, 'expected #{this} to not include ' + _.inspect(val));
|
640
1111
|
}
|
@@ -731,8 +1202,8 @@
|
|
731
1202
|
*
|
732
1203
|
* Asserts that the target is `undefined`.
|
733
1204
|
*
|
734
|
-
*
|
735
|
-
*
|
1205
|
+
* expect(undefined).to.be.undefined;
|
1206
|
+
* expect(null).to.not.be.undefined;
|
736
1207
|
*
|
737
1208
|
* @name undefined
|
738
1209
|
* @api public
|
@@ -1489,6 +1960,7 @@
|
|
1489
1960
|
* @param {String|RegExp} expected error message
|
1490
1961
|
* @param {String} message _optional_
|
1491
1962
|
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
1963
|
+
* @returns error for chaining (null if no error)
|
1492
1964
|
* @api public
|
1493
1965
|
*/
|
1494
1966
|
|
@@ -1513,7 +1985,10 @@
|
|
1513
1985
|
constructor = null;
|
1514
1986
|
errMsg = null;
|
1515
1987
|
} else if (typeof constructor === 'function') {
|
1516
|
-
name =
|
1988
|
+
name = constructor.prototype.name || constructor.name;
|
1989
|
+
if (name === 'Error' && constructor !== Error) {
|
1990
|
+
name = (new constructor()).name;
|
1991
|
+
}
|
1517
1992
|
} else {
|
1518
1993
|
constructor = null;
|
1519
1994
|
}
|
@@ -1527,12 +2002,14 @@
|
|
1527
2002
|
err === desiredError
|
1528
2003
|
, 'expected #{this} to throw #{exp} but #{act} was thrown'
|
1529
2004
|
, 'expected #{this} to not throw #{exp}'
|
1530
|
-
, desiredError
|
1531
|
-
, err
|
2005
|
+
, (desiredError instanceof Error ? desiredError.toString() : desiredError)
|
2006
|
+
, (err instanceof Error ? err.toString() : err)
|
1532
2007
|
);
|
1533
2008
|
|
2009
|
+
flag(this, 'object', err);
|
1534
2010
|
return this;
|
1535
2011
|
}
|
2012
|
+
|
1536
2013
|
// next, check constructor
|
1537
2014
|
if (constructor) {
|
1538
2015
|
this.assert(
|
@@ -1540,11 +2017,15 @@
|
|
1540
2017
|
, 'expected #{this} to throw #{exp} but #{act} was thrown'
|
1541
2018
|
, 'expected #{this} to not throw #{exp} but #{act} was thrown'
|
1542
2019
|
, name
|
1543
|
-
, err
|
2020
|
+
, (err instanceof Error ? err.toString() : err)
|
1544
2021
|
);
|
1545
2022
|
|
1546
|
-
if (!errMsg)
|
2023
|
+
if (!errMsg) {
|
2024
|
+
flag(this, 'object', err);
|
2025
|
+
return this;
|
2026
|
+
}
|
1547
2027
|
}
|
2028
|
+
|
1548
2029
|
// next, check message
|
1549
2030
|
var message = 'object' === _.type(err) && "message" in err
|
1550
2031
|
? err.message
|
@@ -1559,6 +2040,7 @@
|
|
1559
2040
|
, message
|
1560
2041
|
);
|
1561
2042
|
|
2043
|
+
flag(this, 'object', err);
|
1562
2044
|
return this;
|
1563
2045
|
} else if ((message != null) && errMsg && 'string' === typeof errMsg) {
|
1564
2046
|
this.assert(
|
@@ -1569,6 +2051,7 @@
|
|
1569
2051
|
, message
|
1570
2052
|
);
|
1571
2053
|
|
2054
|
+
flag(this, 'object', err);
|
1572
2055
|
return this;
|
1573
2056
|
} else {
|
1574
2057
|
thrown = true;
|
@@ -1591,9 +2074,11 @@
|
|
1591
2074
|
thrown === true
|
1592
2075
|
, 'expected #{this} to throw ' + expectedThrown + actuallyGot
|
1593
2076
|
, 'expected #{this} to not throw ' + expectedThrown + actuallyGot
|
1594
|
-
, desiredError
|
1595
|
-
, thrownError
|
2077
|
+
, (desiredError instanceof Error ? desiredError.toString() : desiredError)
|
2078
|
+
, (thrownError instanceof Error ? thrownError.toString() : thrownError)
|
1596
2079
|
);
|
2080
|
+
|
2081
|
+
flag(this, 'object', thrownError);
|
1597
2082
|
};
|
1598
2083
|
|
1599
2084
|
Assertion.addMethod('throw', assertThrows);
|
@@ -1612,8 +2097,8 @@
|
|
1612
2097
|
* To check if a constructor will respond to a static function,
|
1613
2098
|
* set the `itself` flag.
|
1614
2099
|
*
|
1615
|
-
*
|
1616
|
-
*
|
2100
|
+
* Klass.baz = function(){};
|
2101
|
+
* expect(Klass).itself.to.respondTo('baz');
|
1617
2102
|
*
|
1618
2103
|
* @name respondTo
|
1619
2104
|
* @param {String} method
|
@@ -1641,12 +2126,12 @@
|
|
1641
2126
|
*
|
1642
2127
|
* Sets the `itself` flag, later used by the `respondTo` assertion.
|
1643
2128
|
*
|
1644
|
-
*
|
1645
|
-
*
|
1646
|
-
*
|
2129
|
+
* function Foo() {}
|
2130
|
+
* Foo.bar = function() {}
|
2131
|
+
* Foo.prototype.baz = function() {}
|
1647
2132
|
*
|
1648
|
-
*
|
1649
|
-
*
|
2133
|
+
* expect(Foo).itself.to.respondTo('bar');
|
2134
|
+
* expect(Foo).itself.not.to.respondTo('baz');
|
1650
2135
|
*
|
1651
2136
|
* @name itself
|
1652
2137
|
* @api public
|
@@ -1712,16 +2197,16 @@
|
|
1712
2197
|
}
|
1713
2198
|
|
1714
2199
|
/**
|
1715
|
-
* ### .members
|
2200
|
+
* ### .members(set)
|
1716
2201
|
*
|
1717
2202
|
* Asserts that the target is a superset of `set`,
|
1718
2203
|
* or that the target and `set` have the same members.
|
1719
2204
|
*
|
1720
|
-
*
|
1721
|
-
*
|
2205
|
+
* expect([1, 2, 3]).to.include.members([3, 2]);
|
2206
|
+
* expect([1, 2, 3]).to.not.include.members([3, 2, 8]);
|
1722
2207
|
*
|
1723
|
-
*
|
1724
|
-
*
|
2208
|
+
* expect([4, 2]).to.have.members([2, 4]);
|
2209
|
+
* expect([5, 2]).to.not.have.members([5, 2, 1]);
|
1725
2210
|
*
|
1726
2211
|
* @name members
|
1727
2212
|
* @param {Array} set
|
@@ -1760,7 +2245,7 @@
|
|
1760
2245
|
require.register("chai/lib/chai/interface/assert.js", function(exports, require, module){
|
1761
2246
|
/*!
|
1762
2247
|
* chai
|
1763
|
-
* Copyright(c) 2011-
|
2248
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
1764
2249
|
* MIT Licensed
|
1765
2250
|
*/
|
1766
2251
|
|
@@ -1815,13 +2300,12 @@
|
|
1815
2300
|
*/
|
1816
2301
|
|
1817
2302
|
assert.fail = function (actual, expected, message, operator) {
|
1818
|
-
|
2303
|
+
message = message || 'assert.fail()';
|
2304
|
+
throw new chai.AssertionError(message, {
|
1819
2305
|
actual: actual
|
1820
2306
|
, expected: expected
|
1821
|
-
, message: message
|
1822
2307
|
, operator: operator
|
1823
|
-
|
1824
|
-
});
|
2308
|
+
}, assert.fail);
|
1825
2309
|
};
|
1826
2310
|
|
1827
2311
|
/**
|
@@ -1842,6 +2326,24 @@
|
|
1842
2326
|
new Assertion(val, msg).is.ok;
|
1843
2327
|
};
|
1844
2328
|
|
2329
|
+
/**
|
2330
|
+
* ### .notOk(object, [message])
|
2331
|
+
*
|
2332
|
+
* Asserts that `object` is falsy.
|
2333
|
+
*
|
2334
|
+
* assert.notOk('everything', 'this will fail');
|
2335
|
+
* assert.notOk(false, 'this will pass');
|
2336
|
+
*
|
2337
|
+
* @name notOk
|
2338
|
+
* @param {Mixed} object to test
|
2339
|
+
* @param {String} message
|
2340
|
+
* @api public
|
2341
|
+
*/
|
2342
|
+
|
2343
|
+
assert.notOk = function (val, msg) {
|
2344
|
+
new Assertion(val, msg).is.not.ok;
|
2345
|
+
};
|
2346
|
+
|
1845
2347
|
/**
|
1846
2348
|
* ### .equal(actual, expected, [message])
|
1847
2349
|
*
|
@@ -2399,18 +2901,7 @@
|
|
2399
2901
|
*/
|
2400
2902
|
|
2401
2903
|
assert.include = function (exp, inc, msg) {
|
2402
|
-
|
2403
|
-
|
2404
|
-
if (Array.isArray(exp)) {
|
2405
|
-
obj.to.include(inc);
|
2406
|
-
} else if ('string' === typeof exp) {
|
2407
|
-
obj.to.contain.string(inc);
|
2408
|
-
} else {
|
2409
|
-
throw new chai.AssertionError({
|
2410
|
-
message: 'expected an array or string'
|
2411
|
-
, stackStartFunction: assert.include
|
2412
|
-
});
|
2413
|
-
}
|
2904
|
+
new Assertion(exp, msg).include(inc);
|
2414
2905
|
};
|
2415
2906
|
|
2416
2907
|
/**
|
@@ -2430,18 +2921,7 @@
|
|
2430
2921
|
*/
|
2431
2922
|
|
2432
2923
|
assert.notInclude = function (exp, inc, msg) {
|
2433
|
-
|
2434
|
-
|
2435
|
-
if (Array.isArray(exp)) {
|
2436
|
-
obj.to.not.include(inc);
|
2437
|
-
} else if ('string' === typeof exp) {
|
2438
|
-
obj.to.not.contain.string(inc);
|
2439
|
-
} else {
|
2440
|
-
throw new chai.AssertionError({
|
2441
|
-
message: 'expected an array or string'
|
2442
|
-
, stackStartFunction: assert.include
|
2443
|
-
});
|
2444
|
-
}
|
2924
|
+
new Assertion(exp, msg).not.include(inc);
|
2445
2925
|
};
|
2446
2926
|
|
2447
2927
|
/**
|
@@ -2685,7 +3165,8 @@
|
|
2685
3165
|
errt = null;
|
2686
3166
|
}
|
2687
3167
|
|
2688
|
-
new Assertion(fn, msg).to.Throw(errt, errs);
|
3168
|
+
var assertErr = new Assertion(fn, msg).to.Throw(errt, errs);
|
3169
|
+
return flag(assertErr, 'object');
|
2689
3170
|
};
|
2690
3171
|
|
2691
3172
|
/**
|
@@ -2823,7 +3304,7 @@
|
|
2823
3304
|
require.register("chai/lib/chai/interface/expect.js", function(exports, require, module){
|
2824
3305
|
/*!
|
2825
3306
|
* chai
|
2826
|
-
* Copyright(c) 2011-
|
3307
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
2827
3308
|
* MIT Licensed
|
2828
3309
|
*/
|
2829
3310
|
|
@@ -2838,7 +3319,7 @@
|
|
2838
3319
|
require.register("chai/lib/chai/interface/should.js", function(exports, require, module){
|
2839
3320
|
/*!
|
2840
3321
|
* chai
|
2841
|
-
* Copyright(c) 2011-
|
3322
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
2842
3323
|
* MIT Licensed
|
2843
3324
|
*/
|
2844
3325
|
|
@@ -2917,7 +3398,7 @@
|
|
2917
3398
|
require.register("chai/lib/chai/utils/addChainableMethod.js", function(exports, require, module){
|
2918
3399
|
/*!
|
2919
3400
|
* Chai - addChainingMethod utility
|
2920
|
-
* Copyright(c) 2012-
|
3401
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
2921
3402
|
* MIT Licensed
|
2922
3403
|
*/
|
2923
3404
|
|
@@ -2972,15 +3453,27 @@
|
|
2972
3453
|
*/
|
2973
3454
|
|
2974
3455
|
module.exports = function (ctx, name, method, chainingBehavior) {
|
2975
|
-
if (typeof chainingBehavior !== 'function')
|
3456
|
+
if (typeof chainingBehavior !== 'function') {
|
2976
3457
|
chainingBehavior = function () { };
|
3458
|
+
}
|
3459
|
+
|
3460
|
+
var chainableBehavior = {
|
3461
|
+
method: method
|
3462
|
+
, chainingBehavior: chainingBehavior
|
3463
|
+
};
|
3464
|
+
|
3465
|
+
// save the methods so we can overwrite them later, if we need to.
|
3466
|
+
if (!ctx.__methods) {
|
3467
|
+
ctx.__methods = {};
|
3468
|
+
}
|
3469
|
+
ctx.__methods[name] = chainableBehavior;
|
2977
3470
|
|
2978
3471
|
Object.defineProperty(ctx, name,
|
2979
3472
|
{ get: function () {
|
2980
|
-
chainingBehavior.call(this);
|
3473
|
+
chainableBehavior.chainingBehavior.call(this);
|
2981
3474
|
|
2982
3475
|
var assert = function () {
|
2983
|
-
var result = method.apply(this, arguments);
|
3476
|
+
var result = chainableBehavior.method.apply(this, arguments);
|
2984
3477
|
return result === undefined ? this : result;
|
2985
3478
|
};
|
2986
3479
|
|
@@ -3014,7 +3507,7 @@
|
|
3014
3507
|
require.register("chai/lib/chai/utils/addMethod.js", function(exports, require, module){
|
3015
3508
|
/*!
|
3016
3509
|
* Chai - addMethod utility
|
3017
|
-
* Copyright(c) 2012-
|
3510
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3018
3511
|
* MIT Licensed
|
3019
3512
|
*/
|
3020
3513
|
|
@@ -3054,7 +3547,7 @@
|
|
3054
3547
|
require.register("chai/lib/chai/utils/addProperty.js", function(exports, require, module){
|
3055
3548
|
/*!
|
3056
3549
|
* Chai - addProperty utility
|
3057
|
-
* Copyright(c) 2012-
|
3550
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3058
3551
|
* MIT Licensed
|
3059
3552
|
*/
|
3060
3553
|
|
@@ -3093,141 +3586,11 @@
|
|
3093
3586
|
});
|
3094
3587
|
};
|
3095
3588
|
|
3096
|
-
});
|
3097
|
-
require.register("chai/lib/chai/utils/eql.js", function(exports, require, module){
|
3098
|
-
// This is (almost) directly from Node.js assert
|
3099
|
-
// https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/assert.js
|
3100
|
-
|
3101
|
-
module.exports = _deepEqual;
|
3102
|
-
|
3103
|
-
var getEnumerableProperties = require('./getEnumerableProperties');
|
3104
|
-
|
3105
|
-
// for the browser
|
3106
|
-
var Buffer;
|
3107
|
-
try {
|
3108
|
-
Buffer = require('buffer').Buffer;
|
3109
|
-
} catch (ex) {
|
3110
|
-
Buffer = {
|
3111
|
-
isBuffer: function () { return false; }
|
3112
|
-
};
|
3113
|
-
}
|
3114
|
-
|
3115
|
-
function _deepEqual(actual, expected, memos) {
|
3116
|
-
|
3117
|
-
// 7.1. All identical values are equivalent, as determined by ===.
|
3118
|
-
if (actual === expected) {
|
3119
|
-
return true;
|
3120
|
-
|
3121
|
-
} else if (Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) {
|
3122
|
-
if (actual.length != expected.length) return false;
|
3123
|
-
|
3124
|
-
for (var i = 0; i < actual.length; i++) {
|
3125
|
-
if (actual[i] !== expected[i]) return false;
|
3126
|
-
}
|
3127
|
-
|
3128
|
-
return true;
|
3129
|
-
|
3130
|
-
// 7.2. If the expected value is a Date object, the actual value is
|
3131
|
-
// equivalent if it is also a Date object that refers to the same time.
|
3132
|
-
} else if (actual instanceof Date && expected instanceof Date) {
|
3133
|
-
return actual.getTime() === expected.getTime();
|
3134
|
-
|
3135
|
-
// 7.3. Other pairs that do not both pass typeof value == 'object',
|
3136
|
-
// equivalence is determined by ==.
|
3137
|
-
} else if (typeof actual != 'object' && typeof expected != 'object') {
|
3138
|
-
return actual === expected;
|
3139
|
-
|
3140
|
-
} else if (actual instanceof RegExp && expected instanceof RegExp){
|
3141
|
-
return actual.toString() === expected.toString();
|
3142
|
-
|
3143
|
-
// 7.4. For all other Object pairs, including Array objects, equivalence is
|
3144
|
-
// determined by having the same number of owned properties (as verified
|
3145
|
-
// with Object.prototype.hasOwnProperty.call), the same set of keys
|
3146
|
-
// (although not necessarily the same order), equivalent values for every
|
3147
|
-
// corresponding key, and an identical 'prototype' property. Note: this
|
3148
|
-
// accounts for both named and indexed properties on Arrays.
|
3149
|
-
} else {
|
3150
|
-
return objEquiv(actual, expected, memos);
|
3151
|
-
}
|
3152
|
-
}
|
3153
|
-
|
3154
|
-
function isUndefinedOrNull(value) {
|
3155
|
-
return value === null || value === undefined;
|
3156
|
-
}
|
3157
|
-
|
3158
|
-
function isArguments(object) {
|
3159
|
-
return Object.prototype.toString.call(object) == '[object Arguments]';
|
3160
|
-
}
|
3161
|
-
|
3162
|
-
function objEquiv(a, b, memos) {
|
3163
|
-
if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
|
3164
|
-
return false;
|
3165
|
-
|
3166
|
-
// an identical 'prototype' property.
|
3167
|
-
if (a.prototype !== b.prototype) return false;
|
3168
|
-
|
3169
|
-
// check if we have already compared a and b
|
3170
|
-
var i;
|
3171
|
-
if (memos) {
|
3172
|
-
for(i = 0; i < memos.length; i++) {
|
3173
|
-
if ((memos[i][0] === a && memos[i][1] === b) ||
|
3174
|
-
(memos[i][0] === b && memos[i][1] === a))
|
3175
|
-
return true;
|
3176
|
-
}
|
3177
|
-
} else {
|
3178
|
-
memos = [];
|
3179
|
-
}
|
3180
|
-
|
3181
|
-
//~~~I've managed to break Object.keys through screwy arguments passing.
|
3182
|
-
// Converting to array solves the problem.
|
3183
|
-
if (isArguments(a)) {
|
3184
|
-
if (!isArguments(b)) {
|
3185
|
-
return false;
|
3186
|
-
}
|
3187
|
-
a = pSlice.call(a);
|
3188
|
-
b = pSlice.call(b);
|
3189
|
-
return _deepEqual(a, b, memos);
|
3190
|
-
}
|
3191
|
-
try {
|
3192
|
-
var ka = getEnumerableProperties(a),
|
3193
|
-
kb = getEnumerableProperties(b),
|
3194
|
-
key;
|
3195
|
-
} catch (e) {//happens when one is a string literal and the other isn't
|
3196
|
-
return false;
|
3197
|
-
}
|
3198
|
-
|
3199
|
-
// having the same number of owned properties (keys incorporates
|
3200
|
-
// hasOwnProperty)
|
3201
|
-
if (ka.length != kb.length)
|
3202
|
-
return false;
|
3203
|
-
|
3204
|
-
//the same set of keys (although not necessarily the same order),
|
3205
|
-
ka.sort();
|
3206
|
-
kb.sort();
|
3207
|
-
//~~~cheap key test
|
3208
|
-
for (i = ka.length - 1; i >= 0; i--) {
|
3209
|
-
if (ka[i] != kb[i])
|
3210
|
-
return false;
|
3211
|
-
}
|
3212
|
-
|
3213
|
-
// remember objects we have compared to guard against circular references
|
3214
|
-
memos.push([ a, b ]);
|
3215
|
-
|
3216
|
-
//equivalent values for every corresponding key, and
|
3217
|
-
//~~~possibly expensive deep test
|
3218
|
-
for (i = ka.length - 1; i >= 0; i--) {
|
3219
|
-
key = ka[i];
|
3220
|
-
if (!_deepEqual(a[key], b[key], memos)) return false;
|
3221
|
-
}
|
3222
|
-
|
3223
|
-
return true;
|
3224
|
-
}
|
3225
|
-
|
3226
3589
|
});
|
3227
3590
|
require.register("chai/lib/chai/utils/flag.js", function(exports, require, module){
|
3228
3591
|
/*!
|
3229
3592
|
* Chai - flag utility
|
3230
|
-
* Copyright(c) 2012-
|
3593
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3231
3594
|
* MIT Licensed
|
3232
3595
|
*/
|
3233
3596
|
|
@@ -3262,7 +3625,7 @@
|
|
3262
3625
|
require.register("chai/lib/chai/utils/getActual.js", function(exports, require, module){
|
3263
3626
|
/*!
|
3264
3627
|
* Chai - getActual utility
|
3265
|
-
* Copyright(c) 2012-
|
3628
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3266
3629
|
* MIT Licensed
|
3267
3630
|
*/
|
3268
3631
|
|
@@ -3284,7 +3647,7 @@
|
|
3284
3647
|
require.register("chai/lib/chai/utils/getEnumerableProperties.js", function(exports, require, module){
|
3285
3648
|
/*!
|
3286
3649
|
* Chai - getEnumerableProperties utility
|
3287
|
-
* Copyright(c) 2012-
|
3650
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3288
3651
|
* MIT Licensed
|
3289
3652
|
*/
|
3290
3653
|
|
@@ -3312,7 +3675,7 @@
|
|
3312
3675
|
require.register("chai/lib/chai/utils/getMessage.js", function(exports, require, module){
|
3313
3676
|
/*!
|
3314
3677
|
* Chai - message composition utility
|
3315
|
-
* Copyright(c) 2012-
|
3678
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3316
3679
|
* MIT Licensed
|
3317
3680
|
*/
|
3318
3681
|
|
@@ -3332,7 +3695,7 @@
|
|
3332
3695
|
* and template tags. Template tags will return
|
3333
3696
|
* a stringified inspection of the object referenced.
|
3334
3697
|
*
|
3335
|
-
*
|
3698
|
+
* Message template tags:
|
3336
3699
|
* - `#{this}` current asserted object
|
3337
3700
|
* - `#{act}` actual value
|
3338
3701
|
* - `#{exp}` expected value
|
@@ -3364,7 +3727,7 @@
|
|
3364
3727
|
require.register("chai/lib/chai/utils/getName.js", function(exports, require, module){
|
3365
3728
|
/*!
|
3366
3729
|
* Chai - getName utility
|
3367
|
-
* Copyright(c) 2012-
|
3730
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3368
3731
|
* MIT Licensed
|
3369
3732
|
*/
|
3370
3733
|
|
@@ -3387,7 +3750,7 @@
|
|
3387
3750
|
require.register("chai/lib/chai/utils/getPathValue.js", function(exports, require, module){
|
3388
3751
|
/*!
|
3389
3752
|
* Chai - getPathValue utility
|
3390
|
-
* Copyright(c) 2012-
|
3753
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3391
3754
|
* @see https://github.com/logicalparadox/filtr
|
3392
3755
|
* MIT Licensed
|
3393
3756
|
*/
|
@@ -3492,7 +3855,7 @@
|
|
3492
3855
|
require.register("chai/lib/chai/utils/getProperties.js", function(exports, require, module){
|
3493
3856
|
/*!
|
3494
3857
|
* Chai - getProperties utility
|
3495
|
-
* Copyright(c) 2012-
|
3858
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3496
3859
|
* MIT Licensed
|
3497
3860
|
*/
|
3498
3861
|
|
@@ -3592,7 +3955,7 @@
|
|
3592
3955
|
* Deep equal utility
|
3593
3956
|
*/
|
3594
3957
|
|
3595
|
-
exports.eql = require('
|
3958
|
+
exports.eql = require('deep-eql');
|
3596
3959
|
|
3597
3960
|
/*!
|
3598
3961
|
* Deep path value
|
@@ -3636,6 +3999,12 @@
|
|
3636
3999
|
|
3637
4000
|
exports.addChainableMethod = require('./addChainableMethod');
|
3638
4001
|
|
4002
|
+
/*!
|
4003
|
+
* Overwrite chainable method
|
4004
|
+
*/
|
4005
|
+
|
4006
|
+
exports.overwriteChainableMethod = require('./overwriteChainableMethod');
|
4007
|
+
|
3639
4008
|
|
3640
4009
|
});
|
3641
4010
|
require.register("chai/lib/chai/utils/inspect.js", function(exports, require, module){
|
@@ -3706,7 +4075,11 @@
|
|
3706
4075
|
value.inspect !== exports.inspect &&
|
3707
4076
|
// Also filter out any prototype objects using the circular check.
|
3708
4077
|
!(value.constructor && value.constructor.prototype === value)) {
|
3709
|
-
|
4078
|
+
var ret = value.inspect(recurseTimes);
|
4079
|
+
if (typeof ret !== 'string') {
|
4080
|
+
ret = formatValue(ctx, ret, recurseTimes);
|
4081
|
+
}
|
4082
|
+
return ret;
|
3710
4083
|
}
|
3711
4084
|
|
3712
4085
|
// Primitive types cannot have properties
|
@@ -3960,7 +4333,7 @@
|
|
3960
4333
|
require.register("chai/lib/chai/utils/objDisplay.js", function(exports, require, module){
|
3961
4334
|
/*!
|
3962
4335
|
* Chai - flag utility
|
3963
|
-
* Copyright(c) 2012-
|
4336
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3964
4337
|
* MIT Licensed
|
3965
4338
|
*/
|
3966
4339
|
|
@@ -4011,7 +4384,7 @@
|
|
4011
4384
|
require.register("chai/lib/chai/utils/overwriteMethod.js", function(exports, require, module){
|
4012
4385
|
/*!
|
4013
4386
|
* Chai - overwriteMethod utility
|
4014
|
-
* Copyright(c) 2012-
|
4387
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4015
4388
|
* MIT Licensed
|
4016
4389
|
*/
|
4017
4390
|
|
@@ -4065,7 +4438,7 @@
|
|
4065
4438
|
require.register("chai/lib/chai/utils/overwriteProperty.js", function(exports, require, module){
|
4066
4439
|
/*!
|
4067
4440
|
* Chai - overwriteProperty utility
|
4068
|
-
* Copyright(c) 2012-
|
4441
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4069
4442
|
* MIT Licensed
|
4070
4443
|
*/
|
4071
4444
|
|
@@ -4118,11 +4491,67 @@
|
|
4118
4491
|
});
|
4119
4492
|
};
|
4120
4493
|
|
4494
|
+
});
|
4495
|
+
require.register("chai/lib/chai/utils/overwriteChainableMethod.js", function(exports, require, module){
|
4496
|
+
/*!
|
4497
|
+
* Chai - overwriteChainableMethod utility
|
4498
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4499
|
+
* MIT Licensed
|
4500
|
+
*/
|
4501
|
+
|
4502
|
+
/**
|
4503
|
+
* ### overwriteChainableMethod (ctx, name, fn)
|
4504
|
+
*
|
4505
|
+
* Overwites an already existing chainable method
|
4506
|
+
* and provides access to the previous function or
|
4507
|
+
* property. Must return functions to be used for
|
4508
|
+
* name.
|
4509
|
+
*
|
4510
|
+
* utils.overwriteChainableMethod(chai.Assertion.prototype, 'length',
|
4511
|
+
* function (_super) {
|
4512
|
+
* }
|
4513
|
+
* , function (_super) {
|
4514
|
+
* }
|
4515
|
+
* );
|
4516
|
+
*
|
4517
|
+
* Can also be accessed directly from `chai.Assertion`.
|
4518
|
+
*
|
4519
|
+
* chai.Assertion.overwriteChainableMethod('foo', fn, fn);
|
4520
|
+
*
|
4521
|
+
* Then can be used as any other assertion.
|
4522
|
+
*
|
4523
|
+
* expect(myFoo).to.have.length(3);
|
4524
|
+
* expect(myFoo).to.have.length.above(3);
|
4525
|
+
*
|
4526
|
+
* @param {Object} ctx object whose method / property is to be overwritten
|
4527
|
+
* @param {String} name of method / property to overwrite
|
4528
|
+
* @param {Function} method function that returns a function to be used for name
|
4529
|
+
* @param {Function} chainingBehavior function that returns a function to be used for property
|
4530
|
+
* @name overwriteChainableMethod
|
4531
|
+
* @api public
|
4532
|
+
*/
|
4533
|
+
|
4534
|
+
module.exports = function (ctx, name, method, chainingBehavior) {
|
4535
|
+
var chainableBehavior = ctx.__methods[name];
|
4536
|
+
|
4537
|
+
var _chainingBehavior = chainableBehavior.chainingBehavior;
|
4538
|
+
chainableBehavior.chainingBehavior = function () {
|
4539
|
+
var result = chainingBehavior(_chainingBehavior).call(this);
|
4540
|
+
return result === undefined ? this : result;
|
4541
|
+
};
|
4542
|
+
|
4543
|
+
var _method = chainableBehavior.method;
|
4544
|
+
chainableBehavior.method = function () {
|
4545
|
+
var result = method(_method).apply(this, arguments);
|
4546
|
+
return result === undefined ? this : result;
|
4547
|
+
};
|
4548
|
+
};
|
4549
|
+
|
4121
4550
|
});
|
4122
4551
|
require.register("chai/lib/chai/utils/test.js", function(exports, require, module){
|
4123
4552
|
/*!
|
4124
4553
|
* Chai - test utility
|
4125
|
-
* Copyright(c) 2012-
|
4554
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4126
4555
|
* MIT Licensed
|
4127
4556
|
*/
|
4128
4557
|
|
@@ -4151,7 +4580,7 @@
|
|
4151
4580
|
require.register("chai/lib/chai/utils/transferFlags.js", function(exports, require, module){
|
4152
4581
|
/*!
|
4153
4582
|
* Chai - transferFlags utility
|
4154
|
-
* Copyright(c) 2012-
|
4583
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4155
4584
|
* MIT Licensed
|
4156
4585
|
*/
|
4157
4586
|
|
@@ -4198,7 +4627,7 @@
|
|
4198
4627
|
require.register("chai/lib/chai/utils/type.js", function(exports, require, module){
|
4199
4628
|
/*!
|
4200
4629
|
* Chai - type utility
|
4201
|
-
* Copyright(c) 2012-
|
4630
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4202
4631
|
* MIT Licensed
|
4203
4632
|
*/
|
4204
4633
|
|
@@ -4243,12 +4672,25 @@
|
|
4243
4672
|
};
|
4244
4673
|
|
4245
4674
|
});
|
4246
|
-
require.alias("chai/index.js", "chai/index.js");
|
4247
4675
|
|
4248
|
-
|
4676
|
+
|
4677
|
+
|
4678
|
+
|
4679
|
+
require.alias("chaijs-assertion-error/index.js", "chai/deps/assertion-error/index.js");
|
4680
|
+
require.alias("chaijs-assertion-error/index.js", "chai/deps/assertion-error/index.js");
|
4681
|
+
require.alias("chaijs-assertion-error/index.js", "assertion-error/index.js");
|
4682
|
+
require.alias("chaijs-assertion-error/index.js", "chaijs-assertion-error/index.js");
|
4683
|
+
require.alias("chaijs-deep-eql/lib/eql.js", "chai/deps/deep-eql/lib/eql.js");
|
4684
|
+
require.alias("chaijs-deep-eql/lib/eql.js", "chai/deps/deep-eql/index.js");
|
4685
|
+
require.alias("chaijs-deep-eql/lib/eql.js", "deep-eql/index.js");
|
4686
|
+
require.alias("chaijs-type-detect/lib/type.js", "chaijs-deep-eql/deps/type-detect/lib/type.js");
|
4687
|
+
require.alias("chaijs-type-detect/lib/type.js", "chaijs-deep-eql/deps/type-detect/index.js");
|
4688
|
+
require.alias("chaijs-type-detect/lib/type.js", "chaijs-type-detect/index.js");
|
4689
|
+
require.alias("chaijs-deep-eql/lib/eql.js", "chaijs-deep-eql/index.js");
|
4690
|
+
require.alias("chai/index.js", "chai/index.js");if (typeof exports == "object") {
|
4249
4691
|
module.exports = require("chai");
|
4250
4692
|
} else if (typeof define == "function" && define.amd) {
|
4251
|
-
define(function(){ return require("chai"); });
|
4693
|
+
define([], function(){ return require("chai"); });
|
4252
4694
|
} else {
|
4253
4695
|
this["chai"] = require("chai");
|
4254
4696
|
}})();
|