chai 1.8.1 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.npmignore +1 -1
- package/CONTRIBUTING.md +173 -0
- package/History.md +108 -0
- package/README.md +70 -40
- package/ReleaseNotes.md +220 -0
- package/bower.json +1 -1
- package/chai.js +594 -407
- package/karma.conf.js +4 -5
- package/lib/chai/assertion.js +36 -31
- package/lib/chai/config.js +50 -0
- package/lib/chai/core/assertions.js +119 -30
- package/lib/chai/interface/assert.js +15 -39
- package/lib/chai/interface/expect.js +1 -1
- package/lib/chai/interface/should.js +27 -25
- package/lib/chai/utils/addChainableMethod.js +22 -5
- package/lib/chai/utils/addMethod.js +7 -1
- package/lib/chai/utils/addProperty.js +1 -1
- package/lib/chai/utils/flag.js +1 -1
- package/lib/chai/utils/getActual.js +2 -3
- package/lib/chai/utils/getEnumerableProperties.js +1 -1
- package/lib/chai/utils/getMessage.js +2 -1
- package/lib/chai/utils/getName.js +1 -1
- package/lib/chai/utils/getPathValue.js +1 -1
- package/lib/chai/utils/getProperties.js +1 -1
- package/lib/chai/utils/index.js +6 -0
- package/lib/chai/utils/inspect.js +33 -20
- package/lib/chai/utils/objDisplay.js +3 -2
- package/lib/chai/utils/overwriteChainableMethod.js +53 -0
- package/lib/chai/utils/overwriteMethod.js +1 -1
- package/lib/chai/utils/overwriteProperty.js +1 -1
- package/lib/chai/utils/test.js +1 -1
- package/lib/chai/utils/transferFlags.js +1 -1
- package/lib/chai/utils/type.js +1 -1
- package/lib/chai.js +9 -2
- package/package.json +6 -7
package/chai.js
CHANGED
|
@@ -1,206 +1,144 @@
|
|
|
1
|
+
|
|
1
2
|
;(function(){
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
* Require the
|
|
5
|
+
* Require the module at `name`.
|
|
5
6
|
*
|
|
6
|
-
* @param {String}
|
|
7
|
+
* @param {String} name
|
|
7
8
|
* @return {Object} exports
|
|
8
9
|
* @api public
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
|
-
function require(
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
// lookup failed
|
|
15
|
-
if (null == resolved) {
|
|
16
|
-
orig = orig || path;
|
|
17
|
-
parent = parent || 'root';
|
|
18
|
-
var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
|
|
19
|
-
err.path = orig;
|
|
20
|
-
err.parent = parent;
|
|
21
|
-
err.require = true;
|
|
22
|
-
throw err;
|
|
23
|
-
}
|
|
12
|
+
function require(name) {
|
|
13
|
+
var module = require.modules[name];
|
|
14
|
+
if (!module) throw new Error('failed to require "' + name + '"');
|
|
24
15
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// registered function
|
|
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;
|
|
16
|
+
if (!('exports' in module) && typeof module.definition === 'function') {
|
|
17
|
+
module.client = module.component = true;
|
|
18
|
+
module.definition.call(this, module.exports = {}, module);
|
|
19
|
+
delete module.definition;
|
|
38
20
|
}
|
|
39
21
|
|
|
40
22
|
return module.exports;
|
|
41
23
|
}
|
|
42
24
|
|
|
43
25
|
/**
|
|
44
|
-
*
|
|
26
|
+
* Meta info, accessible in the global scope unless you use AMD option.
|
|
45
27
|
*/
|
|
46
28
|
|
|
47
|
-
require.
|
|
29
|
+
require.loader = 'component';
|
|
48
30
|
|
|
49
31
|
/**
|
|
50
|
-
*
|
|
32
|
+
* Internal helper object, contains a sorting function for semantiv versioning
|
|
51
33
|
*/
|
|
52
|
-
|
|
53
|
-
require.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
var paths = [
|
|
73
|
-
path,
|
|
74
|
-
path + '.js',
|
|
75
|
-
path + '.json',
|
|
76
|
-
path + '/index.js',
|
|
77
|
-
path + '/index.json'
|
|
78
|
-
];
|
|
79
|
-
|
|
80
|
-
for (var i = 0; i < paths.length; i++) {
|
|
81
|
-
var path = paths[i];
|
|
82
|
-
if (require.modules.hasOwnProperty(path)) return path;
|
|
83
|
-
if (require.aliases.hasOwnProperty(path)) return require.aliases[path];
|
|
34
|
+
require.helper = {};
|
|
35
|
+
require.helper.semVerSort = function(a, b) {
|
|
36
|
+
var aArray = a.version.split('.');
|
|
37
|
+
var bArray = b.version.split('.');
|
|
38
|
+
for (var i=0; i<aArray.length; ++i) {
|
|
39
|
+
var aInt = parseInt(aArray[i], 10);
|
|
40
|
+
var bInt = parseInt(bArray[i], 10);
|
|
41
|
+
if (aInt === bInt) {
|
|
42
|
+
var aLex = aArray[i].substr((""+aInt).length);
|
|
43
|
+
var bLex = bArray[i].substr((""+bInt).length);
|
|
44
|
+
if (aLex === '' && bLex !== '') return 1;
|
|
45
|
+
if (aLex !== '' && bLex === '') return -1;
|
|
46
|
+
if (aLex !== '' && bLex !== '') return aLex > bLex ? 1 : -1;
|
|
47
|
+
continue;
|
|
48
|
+
} else if (aInt > bInt) {
|
|
49
|
+
return 1;
|
|
50
|
+
} else {
|
|
51
|
+
return -1;
|
|
52
|
+
}
|
|
84
53
|
}
|
|
85
|
-
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
86
56
|
|
|
87
57
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* @param {String} path
|
|
92
|
-
* @return {String}
|
|
93
|
-
* @api private
|
|
94
|
-
*/
|
|
95
|
-
|
|
96
|
-
require.normalize = function(curr, path) {
|
|
97
|
-
var segs = [];
|
|
98
|
-
|
|
99
|
-
if ('.' != path.charAt(0)) return path;
|
|
58
|
+
* Find and require a module which name starts with the provided name.
|
|
59
|
+
* If multiple modules exists, the highest semver is used.
|
|
60
|
+
* This function can only be used for remote dependencies.
|
|
100
61
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
62
|
+
* @param {String} name - module name: `user~repo`
|
|
63
|
+
* @param {Boolean} returnPath - returns the canonical require path if true,
|
|
64
|
+
* otherwise it returns the epxorted module
|
|
65
|
+
*/
|
|
66
|
+
require.latest = function (name, returnPath) {
|
|
67
|
+
function showError(name) {
|
|
68
|
+
throw new Error('failed to find latest module of "' + name + '"');
|
|
69
|
+
}
|
|
70
|
+
// only remotes with semvers, ignore local files conataining a '/'
|
|
71
|
+
var versionRegexp = /(.*)~(.*)@v?(\d+\.\d+\.\d+[^\/]*)$/;
|
|
72
|
+
var remoteRegexp = /(.*)~(.*)/;
|
|
73
|
+
if (!remoteRegexp.test(name)) showError(name);
|
|
74
|
+
var moduleNames = Object.keys(require.modules);
|
|
75
|
+
var semVerCandidates = [];
|
|
76
|
+
var otherCandidates = []; // for instance: name of the git branch
|
|
77
|
+
for (var i=0; i<moduleNames.length; i++) {
|
|
78
|
+
var moduleName = moduleNames[i];
|
|
79
|
+
if (new RegExp(name + '@').test(moduleName)) {
|
|
80
|
+
var version = moduleName.substr(name.length+1);
|
|
81
|
+
var semVerMatch = versionRegexp.exec(moduleName);
|
|
82
|
+
if (semVerMatch != null) {
|
|
83
|
+
semVerCandidates.push({version: version, name: moduleName});
|
|
84
|
+
} else {
|
|
85
|
+
otherCandidates.push({version: version, name: moduleName});
|
|
86
|
+
}
|
|
109
87
|
}
|
|
110
88
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
89
|
+
if (semVerCandidates.concat(otherCandidates).length === 0) {
|
|
90
|
+
showError(name);
|
|
91
|
+
}
|
|
92
|
+
if (semVerCandidates.length > 0) {
|
|
93
|
+
var module = semVerCandidates.sort(require.helper.semVerSort).pop().name;
|
|
94
|
+
if (returnPath === true) {
|
|
95
|
+
return module;
|
|
96
|
+
}
|
|
97
|
+
return require(module);
|
|
98
|
+
}
|
|
99
|
+
// if the build contains more than one branch of the same module
|
|
100
|
+
// you should not use this funciton
|
|
101
|
+
var module = otherCandidates.pop().name;
|
|
102
|
+
if (returnPath === true) {
|
|
103
|
+
return module;
|
|
104
|
+
}
|
|
105
|
+
return require(module);
|
|
106
|
+
}
|
|
114
107
|
|
|
115
108
|
/**
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* @param {String} path
|
|
119
|
-
* @param {Function} definition
|
|
120
|
-
* @api private
|
|
109
|
+
* Registered modules.
|
|
121
110
|
*/
|
|
122
111
|
|
|
123
|
-
require.
|
|
124
|
-
require.modules[path] = definition;
|
|
125
|
-
};
|
|
112
|
+
require.modules = {};
|
|
126
113
|
|
|
127
114
|
/**
|
|
128
|
-
*
|
|
115
|
+
* Register module at `name` with callback `definition`.
|
|
129
116
|
*
|
|
130
|
-
* @param {String}
|
|
131
|
-
* @param {
|
|
117
|
+
* @param {String} name
|
|
118
|
+
* @param {Function} definition
|
|
132
119
|
* @api private
|
|
133
120
|
*/
|
|
134
121
|
|
|
135
|
-
require.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
require.aliases[to] = from;
|
|
122
|
+
require.register = function (name, definition) {
|
|
123
|
+
require.modules[name] = {
|
|
124
|
+
definition: definition
|
|
125
|
+
};
|
|
140
126
|
};
|
|
141
127
|
|
|
142
128
|
/**
|
|
143
|
-
*
|
|
129
|
+
* Define a module's exports immediately with `exports`.
|
|
144
130
|
*
|
|
145
|
-
* @param {String}
|
|
146
|
-
* @
|
|
131
|
+
* @param {String} name
|
|
132
|
+
* @param {Generic} exports
|
|
147
133
|
* @api private
|
|
148
134
|
*/
|
|
149
135
|
|
|
150
|
-
require.
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* lastIndexOf helper.
|
|
155
|
-
*/
|
|
156
|
-
|
|
157
|
-
function lastIndexOf(arr, obj) {
|
|
158
|
-
var i = arr.length;
|
|
159
|
-
while (i--) {
|
|
160
|
-
if (arr[i] === obj) return i;
|
|
161
|
-
}
|
|
162
|
-
return -1;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* The relative require() itself.
|
|
167
|
-
*/
|
|
168
|
-
|
|
169
|
-
function localRequire(path) {
|
|
170
|
-
var resolved = localRequire.resolve(path);
|
|
171
|
-
return require(resolved, parent, path);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Resolve relative to the parent.
|
|
176
|
-
*/
|
|
177
|
-
|
|
178
|
-
localRequire.resolve = function(path) {
|
|
179
|
-
var c = path.charAt(0);
|
|
180
|
-
if ('/' == c) return path.slice(1);
|
|
181
|
-
if ('.' == c) return require.normalize(p, path);
|
|
182
|
-
|
|
183
|
-
// resolve deps by returning
|
|
184
|
-
// the dep in the nearest "deps"
|
|
185
|
-
// directory
|
|
186
|
-
var segs = parent.split('/');
|
|
187
|
-
var i = lastIndexOf(segs, 'deps') + 1;
|
|
188
|
-
if (!i) i = 0;
|
|
189
|
-
path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
|
|
190
|
-
return path;
|
|
136
|
+
require.define = function (name, exports) {
|
|
137
|
+
require.modules[name] = {
|
|
138
|
+
exports: exports
|
|
191
139
|
};
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Check if module is defined at `path`.
|
|
195
|
-
*/
|
|
196
|
-
|
|
197
|
-
localRequire.exists = function(path) {
|
|
198
|
-
return require.modules.hasOwnProperty(localRequire.resolve(path));
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
return localRequire;
|
|
202
140
|
};
|
|
203
|
-
require.register("chaijs
|
|
141
|
+
require.register("chaijs~assertion-error@1.0.0", function (exports, module) {
|
|
204
142
|
/*!
|
|
205
143
|
* assertion-error
|
|
206
144
|
* Copyright(c) 2013 Jake Luer <jake@qualiancy.com>
|
|
@@ -313,7 +251,8 @@ AssertionError.prototype.toJSON = function (stack) {
|
|
|
313
251
|
};
|
|
314
252
|
|
|
315
253
|
});
|
|
316
|
-
|
|
254
|
+
|
|
255
|
+
require.register("chaijs~type-detect@0.1.1", function (exports, module) {
|
|
317
256
|
/*!
|
|
318
257
|
* type-detect
|
|
319
258
|
* Copyright(c) 2013 jake luer <jake@alogicalparadox.com>
|
|
@@ -458,7 +397,8 @@ Library.prototype.test = function (obj, type) {
|
|
|
458
397
|
};
|
|
459
398
|
|
|
460
399
|
});
|
|
461
|
-
|
|
400
|
+
|
|
401
|
+
require.register("chaijs~deep-eql@0.1.3", function (exports, module) {
|
|
462
402
|
/*!
|
|
463
403
|
* deep-eql
|
|
464
404
|
* Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -469,7 +409,7 @@ require.register("chaijs-deep-eql/lib/eql.js", function(exports, require, module
|
|
|
469
409
|
* Module dependencies
|
|
470
410
|
*/
|
|
471
411
|
|
|
472
|
-
var type = require('type-detect');
|
|
412
|
+
var type = require('chaijs~type-detect@0.1.1');
|
|
473
413
|
|
|
474
414
|
/*!
|
|
475
415
|
* Buffer.isBuffer browser shim
|
|
@@ -718,14 +658,16 @@ function objectEqual(a, b, m) {
|
|
|
718
658
|
}
|
|
719
659
|
|
|
720
660
|
});
|
|
721
|
-
|
|
722
|
-
|
|
661
|
+
|
|
662
|
+
require.register("chai", function (exports, module) {
|
|
663
|
+
module.exports = require('chai/lib/chai.js');
|
|
723
664
|
|
|
724
665
|
});
|
|
725
|
-
|
|
666
|
+
|
|
667
|
+
require.register("chai/lib/chai.js", function (exports, module) {
|
|
726
668
|
/*!
|
|
727
669
|
* chai
|
|
728
|
-
* Copyright(c) 2011-
|
|
670
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
|
729
671
|
* MIT Licensed
|
|
730
672
|
*/
|
|
731
673
|
|
|
@@ -736,19 +678,19 @@ var used = []
|
|
|
736
678
|
* Chai version
|
|
737
679
|
*/
|
|
738
680
|
|
|
739
|
-
exports.version = '1.
|
|
681
|
+
exports.version = '1.10.0';
|
|
740
682
|
|
|
741
683
|
/*!
|
|
742
684
|
* Assertion Error
|
|
743
685
|
*/
|
|
744
686
|
|
|
745
|
-
exports.AssertionError = require('assertion-error');
|
|
687
|
+
exports.AssertionError = require('chaijs~assertion-error@1.0.0');
|
|
746
688
|
|
|
747
689
|
/*!
|
|
748
690
|
* Utils for plugins (not exported)
|
|
749
691
|
*/
|
|
750
692
|
|
|
751
|
-
var util = require('
|
|
693
|
+
var util = require('chai/lib/chai/utils/index.js');
|
|
752
694
|
|
|
753
695
|
/**
|
|
754
696
|
* # .use(function)
|
|
@@ -769,50 +711,61 @@ exports.use = function (fn) {
|
|
|
769
711
|
return this;
|
|
770
712
|
};
|
|
771
713
|
|
|
714
|
+
/*!
|
|
715
|
+
* Configuration
|
|
716
|
+
*/
|
|
717
|
+
|
|
718
|
+
var config = require('chai/lib/chai/config.js');
|
|
719
|
+
exports.config = config;
|
|
720
|
+
|
|
772
721
|
/*!
|
|
773
722
|
* Primary `Assertion` prototype
|
|
774
723
|
*/
|
|
775
724
|
|
|
776
|
-
var assertion = require('
|
|
725
|
+
var assertion = require('chai/lib/chai/assertion.js');
|
|
777
726
|
exports.use(assertion);
|
|
778
727
|
|
|
779
728
|
/*!
|
|
780
729
|
* Core Assertions
|
|
781
730
|
*/
|
|
782
731
|
|
|
783
|
-
var core = require('
|
|
732
|
+
var core = require('chai/lib/chai/core/assertions.js');
|
|
784
733
|
exports.use(core);
|
|
785
734
|
|
|
786
735
|
/*!
|
|
787
736
|
* Expect interface
|
|
788
737
|
*/
|
|
789
738
|
|
|
790
|
-
var expect = require('
|
|
739
|
+
var expect = require('chai/lib/chai/interface/expect.js');
|
|
791
740
|
exports.use(expect);
|
|
792
741
|
|
|
793
742
|
/*!
|
|
794
743
|
* Should interface
|
|
795
744
|
*/
|
|
796
745
|
|
|
797
|
-
var should = require('
|
|
746
|
+
var should = require('chai/lib/chai/interface/should.js');
|
|
798
747
|
exports.use(should);
|
|
799
748
|
|
|
800
749
|
/*!
|
|
801
750
|
* Assert interface
|
|
802
751
|
*/
|
|
803
752
|
|
|
804
|
-
var assert = require('
|
|
753
|
+
var assert = require('chai/lib/chai/interface/assert.js');
|
|
805
754
|
exports.use(assert);
|
|
806
755
|
|
|
807
756
|
});
|
|
808
|
-
|
|
757
|
+
|
|
758
|
+
require.register("chai/lib/chai/assertion.js", function (exports, module) {
|
|
809
759
|
/*!
|
|
810
760
|
* chai
|
|
811
761
|
* http://chaijs.com
|
|
812
|
-
* Copyright(c) 2011-
|
|
762
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
|
813
763
|
* MIT Licensed
|
|
814
764
|
*/
|
|
815
765
|
|
|
766
|
+
var config = require('chai/lib/chai/config.js');
|
|
767
|
+
var NOOP = function() { };
|
|
768
|
+
|
|
816
769
|
module.exports = function (_chai, util) {
|
|
817
770
|
/*!
|
|
818
771
|
* Module dependencies.
|
|
@@ -841,33 +794,27 @@ module.exports = function (_chai, util) {
|
|
|
841
794
|
flag(this, 'message', msg);
|
|
842
795
|
}
|
|
843
796
|
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
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
|
-
*/
|
|
797
|
+
Object.defineProperty(Assertion, 'includeStack', {
|
|
798
|
+
get: function() {
|
|
799
|
+
console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.');
|
|
800
|
+
return config.includeStack;
|
|
801
|
+
},
|
|
802
|
+
set: function(value) {
|
|
803
|
+
console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.');
|
|
804
|
+
config.includeStack = value;
|
|
805
|
+
}
|
|
806
|
+
});
|
|
869
807
|
|
|
870
|
-
Assertion
|
|
808
|
+
Object.defineProperty(Assertion, 'showDiff', {
|
|
809
|
+
get: function() {
|
|
810
|
+
console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.');
|
|
811
|
+
return config.showDiff;
|
|
812
|
+
},
|
|
813
|
+
set: function(value) {
|
|
814
|
+
console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.');
|
|
815
|
+
config.showDiff = value;
|
|
816
|
+
}
|
|
817
|
+
});
|
|
871
818
|
|
|
872
819
|
Assertion.addProperty = function (name, fn) {
|
|
873
820
|
util.addProperty(this.prototype, name, fn);
|
|
@@ -881,6 +828,10 @@ module.exports = function (_chai, util) {
|
|
|
881
828
|
util.addChainableMethod(this.prototype, name, fn, chainingBehavior);
|
|
882
829
|
};
|
|
883
830
|
|
|
831
|
+
Assertion.addChainableNoop = function(name, fn) {
|
|
832
|
+
util.addChainableMethod(this.prototype, name, NOOP, fn);
|
|
833
|
+
};
|
|
834
|
+
|
|
884
835
|
Assertion.overwriteProperty = function (name, fn) {
|
|
885
836
|
util.overwriteProperty(this.prototype, name, fn);
|
|
886
837
|
};
|
|
@@ -889,6 +840,10 @@ module.exports = function (_chai, util) {
|
|
|
889
840
|
util.overwriteMethod(this.prototype, name, fn);
|
|
890
841
|
};
|
|
891
842
|
|
|
843
|
+
Assertion.overwriteChainableMethod = function (name, fn, chainingBehavior) {
|
|
844
|
+
util.overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);
|
|
845
|
+
};
|
|
846
|
+
|
|
892
847
|
/*!
|
|
893
848
|
* ### .assert(expression, message, negateMessage, expected, actual)
|
|
894
849
|
*
|
|
@@ -896,8 +851,8 @@ module.exports = function (_chai, util) {
|
|
|
896
851
|
*
|
|
897
852
|
* @name assert
|
|
898
853
|
* @param {Philosophical} expression to be tested
|
|
899
|
-
* @param {String} message to display if fails
|
|
900
|
-
* @param {String} negatedMessage to display if negated expression fails
|
|
854
|
+
* @param {String or Function} message or function that returns message to display if fails
|
|
855
|
+
* @param {String or Function} negatedMessage or function that returns negatedMessage to display if negated expression fails
|
|
901
856
|
* @param {Mixed} expected value (remember to check for negation)
|
|
902
857
|
* @param {Mixed} actual (optional) will default to `this.obj`
|
|
903
858
|
* @api private
|
|
@@ -906,7 +861,7 @@ module.exports = function (_chai, util) {
|
|
|
906
861
|
Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) {
|
|
907
862
|
var ok = util.test(this, arguments);
|
|
908
863
|
if (true !== showDiff) showDiff = false;
|
|
909
|
-
if (true !==
|
|
864
|
+
if (true !== config.showDiff) showDiff = false;
|
|
910
865
|
|
|
911
866
|
if (!ok) {
|
|
912
867
|
var msg = util.getMessage(this, arguments)
|
|
@@ -915,7 +870,7 @@ module.exports = function (_chai, util) {
|
|
|
915
870
|
actual: actual
|
|
916
871
|
, expected: expected
|
|
917
872
|
, showDiff: showDiff
|
|
918
|
-
}, (
|
|
873
|
+
}, (config.includeStack) ? this.assert : flag(this, 'ssfi'));
|
|
919
874
|
}
|
|
920
875
|
};
|
|
921
876
|
|
|
@@ -938,11 +893,66 @@ module.exports = function (_chai, util) {
|
|
|
938
893
|
};
|
|
939
894
|
|
|
940
895
|
});
|
|
941
|
-
|
|
896
|
+
|
|
897
|
+
require.register("chai/lib/chai/config.js", function (exports, module) {
|
|
898
|
+
module.exports = {
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* ### config.includeStack
|
|
902
|
+
*
|
|
903
|
+
* User configurable property, influences whether stack trace
|
|
904
|
+
* is included in Assertion error message. Default of false
|
|
905
|
+
* suppresses stack trace in the error message.
|
|
906
|
+
*
|
|
907
|
+
* chai.config.includeStack = true; // enable stack on error
|
|
908
|
+
*
|
|
909
|
+
* @param {Boolean}
|
|
910
|
+
* @api public
|
|
911
|
+
*/
|
|
912
|
+
|
|
913
|
+
includeStack: false,
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* ### config.showDiff
|
|
917
|
+
*
|
|
918
|
+
* User configurable property, influences whether or not
|
|
919
|
+
* the `showDiff` flag should be included in the thrown
|
|
920
|
+
* AssertionErrors. `false` will always be `false`; `true`
|
|
921
|
+
* will be true when the assertion has requested a diff
|
|
922
|
+
* be shown.
|
|
923
|
+
*
|
|
924
|
+
* @param {Boolean}
|
|
925
|
+
* @api public
|
|
926
|
+
*/
|
|
927
|
+
|
|
928
|
+
showDiff: true,
|
|
929
|
+
|
|
930
|
+
/**
|
|
931
|
+
* ### config.truncateThreshold
|
|
932
|
+
*
|
|
933
|
+
* User configurable property, sets length threshold for actual and
|
|
934
|
+
* expected values in assertion errors. If this threshold is exceeded,
|
|
935
|
+
* the value is truncated.
|
|
936
|
+
*
|
|
937
|
+
* Set it to zero if you want to disable truncating altogether.
|
|
938
|
+
*
|
|
939
|
+
* chai.config.truncateThreshold = 0; // disable truncating
|
|
940
|
+
*
|
|
941
|
+
* @param {Number}
|
|
942
|
+
* @api public
|
|
943
|
+
*/
|
|
944
|
+
|
|
945
|
+
truncateThreshold: 40
|
|
946
|
+
|
|
947
|
+
};
|
|
948
|
+
|
|
949
|
+
});
|
|
950
|
+
|
|
951
|
+
require.register("chai/lib/chai/core/assertions.js", function (exports, module) {
|
|
942
952
|
/*!
|
|
943
953
|
* chai
|
|
944
954
|
* http://chaijs.com
|
|
945
|
-
* Copyright(c) 2011-
|
|
955
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
|
946
956
|
* MIT Licensed
|
|
947
957
|
*/
|
|
948
958
|
|
|
@@ -954,9 +964,9 @@ module.exports = function (chai, _) {
|
|
|
954
964
|
/**
|
|
955
965
|
* ### Language Chains
|
|
956
966
|
*
|
|
957
|
-
* The following are
|
|
967
|
+
* The following are provided as chainable getters to
|
|
958
968
|
* improve the readability of your assertions. They
|
|
959
|
-
* do not provide
|
|
969
|
+
* do not provide testing capabilities unless they
|
|
960
970
|
* have been overwritten by a plugin.
|
|
961
971
|
*
|
|
962
972
|
* **Chains**
|
|
@@ -967,6 +977,7 @@ module.exports = function (chai, _) {
|
|
|
967
977
|
* - is
|
|
968
978
|
* - that
|
|
969
979
|
* - and
|
|
980
|
+
* - has
|
|
970
981
|
* - have
|
|
971
982
|
* - with
|
|
972
983
|
* - at
|
|
@@ -978,7 +989,7 @@ module.exports = function (chai, _) {
|
|
|
978
989
|
*/
|
|
979
990
|
|
|
980
991
|
[ 'to', 'be', 'been'
|
|
981
|
-
, 'is', 'and', 'have'
|
|
992
|
+
, 'is', 'and', 'has', 'have'
|
|
982
993
|
, 'with', 'that', 'at'
|
|
983
994
|
, 'of', 'same' ].forEach(function (chain) {
|
|
984
995
|
Assertion.addProperty(chain, function () {
|
|
@@ -1086,9 +1097,28 @@ module.exports = function (chai, _) {
|
|
|
1086
1097
|
|
|
1087
1098
|
function include (val, msg) {
|
|
1088
1099
|
if (msg) flag(this, 'message', msg);
|
|
1089
|
-
var obj = flag(this, 'object')
|
|
1100
|
+
var obj = flag(this, 'object');
|
|
1101
|
+
var expected = false;
|
|
1102
|
+
if (_.type(obj) === 'array' && _.type(val) === 'object') {
|
|
1103
|
+
for (var i in obj) {
|
|
1104
|
+
if (_.eql(obj[i], val)) {
|
|
1105
|
+
expected = true;
|
|
1106
|
+
break;
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
} else if (_.type(val) === 'object') {
|
|
1110
|
+
if (!flag(this, 'negate')) {
|
|
1111
|
+
for (var k in val) new Assertion(obj).property(k, val[k]);
|
|
1112
|
+
return;
|
|
1113
|
+
}
|
|
1114
|
+
var subset = {}
|
|
1115
|
+
for (var k in val) subset[k] = obj[k]
|
|
1116
|
+
expected = _.eql(subset, val);
|
|
1117
|
+
} else {
|
|
1118
|
+
expected = obj && ~obj.indexOf(val)
|
|
1119
|
+
}
|
|
1090
1120
|
this.assert(
|
|
1091
|
-
|
|
1121
|
+
expected
|
|
1092
1122
|
, 'expected #{this} to include ' + _.inspect(val)
|
|
1093
1123
|
, 'expected #{this} to not include ' + _.inspect(val));
|
|
1094
1124
|
}
|
|
@@ -1107,11 +1137,15 @@ module.exports = function (chai, _) {
|
|
|
1107
1137
|
* expect(undefined).to.not.be.ok;
|
|
1108
1138
|
* expect(null).to.not.be.ok;
|
|
1109
1139
|
*
|
|
1140
|
+
* Can also be used as a function, which prevents some linter errors.
|
|
1141
|
+
*
|
|
1142
|
+
* expect('everthing').to.be.ok();
|
|
1143
|
+
*
|
|
1110
1144
|
* @name ok
|
|
1111
1145
|
* @api public
|
|
1112
1146
|
*/
|
|
1113
1147
|
|
|
1114
|
-
Assertion.
|
|
1148
|
+
Assertion.addChainableNoop('ok', function () {
|
|
1115
1149
|
this.assert(
|
|
1116
1150
|
flag(this, 'object')
|
|
1117
1151
|
, 'expected #{this} to be truthy'
|
|
@@ -1126,11 +1160,15 @@ module.exports = function (chai, _) {
|
|
|
1126
1160
|
* expect(true).to.be.true;
|
|
1127
1161
|
* expect(1).to.not.be.true;
|
|
1128
1162
|
*
|
|
1163
|
+
* Can also be used as a function, which prevents some linter errors.
|
|
1164
|
+
*
|
|
1165
|
+
* expect(true).to.be.true();
|
|
1166
|
+
*
|
|
1129
1167
|
* @name true
|
|
1130
1168
|
* @api public
|
|
1131
1169
|
*/
|
|
1132
1170
|
|
|
1133
|
-
Assertion.
|
|
1171
|
+
Assertion.addChainableNoop('true', function () {
|
|
1134
1172
|
this.assert(
|
|
1135
1173
|
true === flag(this, 'object')
|
|
1136
1174
|
, 'expected #{this} to be true'
|
|
@@ -1147,11 +1185,15 @@ module.exports = function (chai, _) {
|
|
|
1147
1185
|
* expect(false).to.be.false;
|
|
1148
1186
|
* expect(0).to.not.be.false;
|
|
1149
1187
|
*
|
|
1188
|
+
* Can also be used as a function, which prevents some linter errors.
|
|
1189
|
+
*
|
|
1190
|
+
* expect(false).to.be.false();
|
|
1191
|
+
*
|
|
1150
1192
|
* @name false
|
|
1151
1193
|
* @api public
|
|
1152
1194
|
*/
|
|
1153
1195
|
|
|
1154
|
-
Assertion.
|
|
1196
|
+
Assertion.addChainableNoop('false', function () {
|
|
1155
1197
|
this.assert(
|
|
1156
1198
|
false === flag(this, 'object')
|
|
1157
1199
|
, 'expected #{this} to be false'
|
|
@@ -1168,11 +1210,15 @@ module.exports = function (chai, _) {
|
|
|
1168
1210
|
* expect(null).to.be.null;
|
|
1169
1211
|
* expect(undefined).not.to.be.null;
|
|
1170
1212
|
*
|
|
1213
|
+
* Can also be used as a function, which prevents some linter errors.
|
|
1214
|
+
*
|
|
1215
|
+
* expect(null).to.be.null();
|
|
1216
|
+
*
|
|
1171
1217
|
* @name null
|
|
1172
1218
|
* @api public
|
|
1173
1219
|
*/
|
|
1174
1220
|
|
|
1175
|
-
Assertion.
|
|
1221
|
+
Assertion.addChainableNoop('null', function () {
|
|
1176
1222
|
this.assert(
|
|
1177
1223
|
null === flag(this, 'object')
|
|
1178
1224
|
, 'expected #{this} to be null'
|
|
@@ -1188,11 +1234,15 @@ module.exports = function (chai, _) {
|
|
|
1188
1234
|
* expect(undefined).to.be.undefined;
|
|
1189
1235
|
* expect(null).to.not.be.undefined;
|
|
1190
1236
|
*
|
|
1237
|
+
* Can also be used as a function, which prevents some linter errors.
|
|
1238
|
+
*
|
|
1239
|
+
* expect(undefined).to.be.undefined();
|
|
1240
|
+
*
|
|
1191
1241
|
* @name undefined
|
|
1192
1242
|
* @api public
|
|
1193
1243
|
*/
|
|
1194
1244
|
|
|
1195
|
-
Assertion.
|
|
1245
|
+
Assertion.addChainableNoop('undefined', function () {
|
|
1196
1246
|
this.assert(
|
|
1197
1247
|
undefined === flag(this, 'object')
|
|
1198
1248
|
, 'expected #{this} to be undefined'
|
|
@@ -1213,11 +1263,15 @@ module.exports = function (chai, _) {
|
|
|
1213
1263
|
* expect(bar).to.not.exist;
|
|
1214
1264
|
* expect(baz).to.not.exist;
|
|
1215
1265
|
*
|
|
1266
|
+
* Can also be used as a function, which prevents some linter errors.
|
|
1267
|
+
*
|
|
1268
|
+
* expect(foo).to.exist();
|
|
1269
|
+
*
|
|
1216
1270
|
* @name exist
|
|
1217
1271
|
* @api public
|
|
1218
1272
|
*/
|
|
1219
1273
|
|
|
1220
|
-
Assertion.
|
|
1274
|
+
Assertion.addChainableNoop('exist', function () {
|
|
1221
1275
|
this.assert(
|
|
1222
1276
|
null != flag(this, 'object')
|
|
1223
1277
|
, 'expected #{this} to exist'
|
|
@@ -1237,11 +1291,15 @@ module.exports = function (chai, _) {
|
|
|
1237
1291
|
* expect('').to.be.empty;
|
|
1238
1292
|
* expect({}).to.be.empty;
|
|
1239
1293
|
*
|
|
1294
|
+
* Can also be used as a function, which prevents some linter errors.
|
|
1295
|
+
*
|
|
1296
|
+
* expect([]).to.be.empty();
|
|
1297
|
+
*
|
|
1240
1298
|
* @name empty
|
|
1241
1299
|
* @api public
|
|
1242
1300
|
*/
|
|
1243
1301
|
|
|
1244
|
-
Assertion.
|
|
1302
|
+
Assertion.addChainableNoop('empty', function () {
|
|
1245
1303
|
var obj = flag(this, 'object')
|
|
1246
1304
|
, expected = obj;
|
|
1247
1305
|
|
|
@@ -1267,6 +1325,12 @@ module.exports = function (chai, _) {
|
|
|
1267
1325
|
* expect(arguments).to.be.arguments;
|
|
1268
1326
|
* }
|
|
1269
1327
|
*
|
|
1328
|
+
* Can also be used as a function, which prevents some linter errors.
|
|
1329
|
+
*
|
|
1330
|
+
* function test () {
|
|
1331
|
+
* expect(arguments).to.be.arguments();
|
|
1332
|
+
* }
|
|
1333
|
+
*
|
|
1270
1334
|
* @name arguments
|
|
1271
1335
|
* @alias Arguments
|
|
1272
1336
|
* @api public
|
|
@@ -1282,8 +1346,8 @@ module.exports = function (chai, _) {
|
|
|
1282
1346
|
);
|
|
1283
1347
|
}
|
|
1284
1348
|
|
|
1285
|
-
Assertion.
|
|
1286
|
-
Assertion.
|
|
1349
|
+
Assertion.addChainableNoop('arguments', checkArguments);
|
|
1350
|
+
Assertion.addChainableNoop('Arguments', checkArguments);
|
|
1287
1351
|
|
|
1288
1352
|
/**
|
|
1289
1353
|
* ### .equal(value)
|
|
@@ -1792,7 +1856,7 @@ module.exports = function (chai, _) {
|
|
|
1792
1856
|
}
|
|
1793
1857
|
|
|
1794
1858
|
Assertion.addChainableMethod('length', assertLength, assertLengthChain);
|
|
1795
|
-
Assertion.addMethod('lengthOf', assertLength
|
|
1859
|
+
Assertion.addMethod('lengthOf', assertLength);
|
|
1796
1860
|
|
|
1797
1861
|
/**
|
|
1798
1862
|
* ### .match(regexp)
|
|
@@ -1871,6 +1935,7 @@ module.exports = function (chai, _) {
|
|
|
1871
1935
|
if (!keys.length) throw new Error('keys required');
|
|
1872
1936
|
|
|
1873
1937
|
var actual = Object.keys(obj)
|
|
1938
|
+
, expected = keys
|
|
1874
1939
|
, len = keys.length;
|
|
1875
1940
|
|
|
1876
1941
|
// Inclusion
|
|
@@ -1905,6 +1970,9 @@ module.exports = function (chai, _) {
|
|
|
1905
1970
|
ok
|
|
1906
1971
|
, 'expected #{this} to ' + str
|
|
1907
1972
|
, 'expected #{this} to not ' + str
|
|
1973
|
+
, expected.sort()
|
|
1974
|
+
, actual.sort()
|
|
1975
|
+
, true
|
|
1908
1976
|
);
|
|
1909
1977
|
}
|
|
1910
1978
|
|
|
@@ -1943,6 +2011,7 @@ module.exports = function (chai, _) {
|
|
|
1943
2011
|
* @param {String|RegExp} expected error message
|
|
1944
2012
|
* @param {String} message _optional_
|
|
1945
2013
|
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
|
2014
|
+
* @returns error for chaining (null if no error)
|
|
1946
2015
|
* @api public
|
|
1947
2016
|
*/
|
|
1948
2017
|
|
|
@@ -1967,7 +2036,10 @@ module.exports = function (chai, _) {
|
|
|
1967
2036
|
constructor = null;
|
|
1968
2037
|
errMsg = null;
|
|
1969
2038
|
} else if (typeof constructor === 'function') {
|
|
1970
|
-
name =
|
|
2039
|
+
name = constructor.prototype.name || constructor.name;
|
|
2040
|
+
if (name === 'Error' && constructor !== Error) {
|
|
2041
|
+
name = (new constructor()).name;
|
|
2042
|
+
}
|
|
1971
2043
|
} else {
|
|
1972
2044
|
constructor = null;
|
|
1973
2045
|
}
|
|
@@ -1981,12 +2053,14 @@ module.exports = function (chai, _) {
|
|
|
1981
2053
|
err === desiredError
|
|
1982
2054
|
, 'expected #{this} to throw #{exp} but #{act} was thrown'
|
|
1983
2055
|
, 'expected #{this} to not throw #{exp}'
|
|
1984
|
-
, desiredError
|
|
1985
|
-
, err
|
|
2056
|
+
, (desiredError instanceof Error ? desiredError.toString() : desiredError)
|
|
2057
|
+
, (err instanceof Error ? err.toString() : err)
|
|
1986
2058
|
);
|
|
1987
2059
|
|
|
2060
|
+
flag(this, 'object', err);
|
|
1988
2061
|
return this;
|
|
1989
2062
|
}
|
|
2063
|
+
|
|
1990
2064
|
// next, check constructor
|
|
1991
2065
|
if (constructor) {
|
|
1992
2066
|
this.assert(
|
|
@@ -1994,11 +2068,15 @@ module.exports = function (chai, _) {
|
|
|
1994
2068
|
, 'expected #{this} to throw #{exp} but #{act} was thrown'
|
|
1995
2069
|
, 'expected #{this} to not throw #{exp} but #{act} was thrown'
|
|
1996
2070
|
, name
|
|
1997
|
-
, err
|
|
2071
|
+
, (err instanceof Error ? err.toString() : err)
|
|
1998
2072
|
);
|
|
1999
2073
|
|
|
2000
|
-
if (!errMsg)
|
|
2074
|
+
if (!errMsg) {
|
|
2075
|
+
flag(this, 'object', err);
|
|
2076
|
+
return this;
|
|
2077
|
+
}
|
|
2001
2078
|
}
|
|
2079
|
+
|
|
2002
2080
|
// next, check message
|
|
2003
2081
|
var message = 'object' === _.type(err) && "message" in err
|
|
2004
2082
|
? err.message
|
|
@@ -2013,6 +2091,7 @@ module.exports = function (chai, _) {
|
|
|
2013
2091
|
, message
|
|
2014
2092
|
);
|
|
2015
2093
|
|
|
2094
|
+
flag(this, 'object', err);
|
|
2016
2095
|
return this;
|
|
2017
2096
|
} else if ((message != null) && errMsg && 'string' === typeof errMsg) {
|
|
2018
2097
|
this.assert(
|
|
@@ -2023,6 +2102,7 @@ module.exports = function (chai, _) {
|
|
|
2023
2102
|
, message
|
|
2024
2103
|
);
|
|
2025
2104
|
|
|
2105
|
+
flag(this, 'object', err);
|
|
2026
2106
|
return this;
|
|
2027
2107
|
} else {
|
|
2028
2108
|
thrown = true;
|
|
@@ -2045,9 +2125,11 @@ module.exports = function (chai, _) {
|
|
|
2045
2125
|
thrown === true
|
|
2046
2126
|
, 'expected #{this} to throw ' + expectedThrown + actuallyGot
|
|
2047
2127
|
, 'expected #{this} to not throw ' + expectedThrown + actuallyGot
|
|
2048
|
-
, desiredError
|
|
2049
|
-
, thrownError
|
|
2128
|
+
, (desiredError instanceof Error ? desiredError.toString() : desiredError)
|
|
2129
|
+
, (thrownError instanceof Error ? thrownError.toString() : thrownError)
|
|
2050
2130
|
);
|
|
2131
|
+
|
|
2132
|
+
flag(this, 'object', thrownError);
|
|
2051
2133
|
};
|
|
2052
2134
|
|
|
2053
2135
|
Assertion.addMethod('throw', assertThrows);
|
|
@@ -2126,12 +2208,13 @@ module.exports = function (chai, _) {
|
|
|
2126
2208
|
Assertion.addMethod('satisfy', function (matcher, msg) {
|
|
2127
2209
|
if (msg) flag(this, 'message', msg);
|
|
2128
2210
|
var obj = flag(this, 'object');
|
|
2211
|
+
var result = matcher(obj);
|
|
2129
2212
|
this.assert(
|
|
2130
|
-
|
|
2213
|
+
result
|
|
2131
2214
|
, 'expected #{this} to satisfy ' + _.objDisplay(matcher)
|
|
2132
2215
|
, 'expected #{this} to not satisfy' + _.objDisplay(matcher)
|
|
2133
2216
|
, this.negate ? false : true
|
|
2134
|
-
,
|
|
2217
|
+
, result
|
|
2135
2218
|
);
|
|
2136
2219
|
});
|
|
2137
2220
|
|
|
@@ -2152,6 +2235,12 @@ module.exports = function (chai, _) {
|
|
|
2152
2235
|
Assertion.addMethod('closeTo', function (expected, delta, msg) {
|
|
2153
2236
|
if (msg) flag(this, 'message', msg);
|
|
2154
2237
|
var obj = flag(this, 'object');
|
|
2238
|
+
|
|
2239
|
+
new Assertion(obj, msg).is.a('number');
|
|
2240
|
+
if (_.type(expected) !== 'number' || _.type(delta) !== 'number') {
|
|
2241
|
+
throw new Error('the arguments to closeTo must be numbers');
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2155
2244
|
this.assert(
|
|
2156
2245
|
Math.abs(obj - expected) <= delta
|
|
2157
2246
|
, 'expected #{this} to be close to ' + expected + ' +/- ' + delta
|
|
@@ -2159,9 +2248,13 @@ module.exports = function (chai, _) {
|
|
|
2159
2248
|
);
|
|
2160
2249
|
});
|
|
2161
2250
|
|
|
2162
|
-
function isSubsetOf(subset, superset) {
|
|
2251
|
+
function isSubsetOf(subset, superset, cmp) {
|
|
2163
2252
|
return subset.every(function(elem) {
|
|
2164
|
-
return superset.indexOf(elem) !== -1;
|
|
2253
|
+
if (!cmp) return superset.indexOf(elem) !== -1;
|
|
2254
|
+
|
|
2255
|
+
return superset.some(function(elem2) {
|
|
2256
|
+
return cmp(elem, elem2);
|
|
2257
|
+
});
|
|
2165
2258
|
})
|
|
2166
2259
|
}
|
|
2167
2260
|
|
|
@@ -2169,7 +2262,9 @@ module.exports = function (chai, _) {
|
|
|
2169
2262
|
* ### .members(set)
|
|
2170
2263
|
*
|
|
2171
2264
|
* Asserts that the target is a superset of `set`,
|
|
2172
|
-
* or that the target and `set` have the same members.
|
|
2265
|
+
* or that the target and `set` have the same strictly-equal (===) members.
|
|
2266
|
+
* Alternately, if the `deep` flag is set, set members are compared for deep
|
|
2267
|
+
* equality.
|
|
2173
2268
|
*
|
|
2174
2269
|
* expect([1, 2, 3]).to.include.members([3, 2]);
|
|
2175
2270
|
* expect([1, 2, 3]).to.not.include.members([3, 2, 8]);
|
|
@@ -2177,6 +2272,8 @@ module.exports = function (chai, _) {
|
|
|
2177
2272
|
* expect([4, 2]).to.have.members([2, 4]);
|
|
2178
2273
|
* expect([5, 2]).to.not.have.members([5, 2, 1]);
|
|
2179
2274
|
*
|
|
2275
|
+
* expect([{ id: 1 }]).to.deep.include.members([{ id: 1 }]);
|
|
2276
|
+
*
|
|
2180
2277
|
* @name members
|
|
2181
2278
|
* @param {Array} set
|
|
2182
2279
|
* @param {String} message _optional_
|
|
@@ -2190,9 +2287,11 @@ module.exports = function (chai, _) {
|
|
|
2190
2287
|
new Assertion(obj).to.be.an('array');
|
|
2191
2288
|
new Assertion(subset).to.be.an('array');
|
|
2192
2289
|
|
|
2290
|
+
var cmp = flag(this, 'deep') ? _.eql : undefined;
|
|
2291
|
+
|
|
2193
2292
|
if (flag(this, 'contains')) {
|
|
2194
2293
|
return this.assert(
|
|
2195
|
-
isSubsetOf(subset, obj)
|
|
2294
|
+
isSubsetOf(subset, obj, cmp)
|
|
2196
2295
|
, 'expected #{this} to be a superset of #{act}'
|
|
2197
2296
|
, 'expected #{this} to not be a superset of #{act}'
|
|
2198
2297
|
, obj
|
|
@@ -2201,7 +2300,7 @@ module.exports = function (chai, _) {
|
|
|
2201
2300
|
}
|
|
2202
2301
|
|
|
2203
2302
|
this.assert(
|
|
2204
|
-
isSubsetOf(obj, subset) && isSubsetOf(subset, obj)
|
|
2303
|
+
isSubsetOf(obj, subset, cmp) && isSubsetOf(subset, obj, cmp)
|
|
2205
2304
|
, 'expected #{this} to have the same members as #{act}'
|
|
2206
2305
|
, 'expected #{this} to not have the same members as #{act}'
|
|
2207
2306
|
, obj
|
|
@@ -2211,10 +2310,11 @@ module.exports = function (chai, _) {
|
|
|
2211
2310
|
};
|
|
2212
2311
|
|
|
2213
2312
|
});
|
|
2214
|
-
|
|
2313
|
+
|
|
2314
|
+
require.register("chai/lib/chai/interface/assert.js", function (exports, module) {
|
|
2215
2315
|
/*!
|
|
2216
2316
|
* chai
|
|
2217
|
-
* Copyright(c) 2011-
|
|
2317
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
|
2218
2318
|
* MIT Licensed
|
|
2219
2319
|
*/
|
|
2220
2320
|
|
|
@@ -2247,7 +2347,7 @@ module.exports = function (chai, util) {
|
|
|
2247
2347
|
*/
|
|
2248
2348
|
|
|
2249
2349
|
var assert = chai.assert = function (express, errmsg) {
|
|
2250
|
-
var test = new Assertion(null);
|
|
2350
|
+
var test = new Assertion(null, null, chai.assert);
|
|
2251
2351
|
test.assert(
|
|
2252
2352
|
express
|
|
2253
2353
|
, errmsg
|
|
@@ -2269,13 +2369,12 @@ module.exports = function (chai, util) {
|
|
|
2269
2369
|
*/
|
|
2270
2370
|
|
|
2271
2371
|
assert.fail = function (actual, expected, message, operator) {
|
|
2272
|
-
|
|
2372
|
+
message = message || 'assert.fail()';
|
|
2373
|
+
throw new chai.AssertionError(message, {
|
|
2273
2374
|
actual: actual
|
|
2274
2375
|
, expected: expected
|
|
2275
|
-
, message: message
|
|
2276
2376
|
, operator: operator
|
|
2277
|
-
|
|
2278
|
-
});
|
|
2377
|
+
}, assert.fail);
|
|
2279
2378
|
};
|
|
2280
2379
|
|
|
2281
2380
|
/**
|
|
@@ -2329,7 +2428,7 @@ module.exports = function (chai, util) {
|
|
|
2329
2428
|
*/
|
|
2330
2429
|
|
|
2331
2430
|
assert.equal = function (act, exp, msg) {
|
|
2332
|
-
var test = new Assertion(act, msg);
|
|
2431
|
+
var test = new Assertion(act, msg, assert.equal);
|
|
2333
2432
|
|
|
2334
2433
|
test.assert(
|
|
2335
2434
|
exp == flag(test, 'object')
|
|
@@ -2355,7 +2454,7 @@ module.exports = function (chai, util) {
|
|
|
2355
2454
|
*/
|
|
2356
2455
|
|
|
2357
2456
|
assert.notEqual = function (act, exp, msg) {
|
|
2358
|
-
var test = new Assertion(act, msg);
|
|
2457
|
+
var test = new Assertion(act, msg, assert.notEqual);
|
|
2359
2458
|
|
|
2360
2459
|
test.assert(
|
|
2361
2460
|
exp != flag(test, 'object')
|
|
@@ -2606,8 +2705,8 @@ module.exports = function (chai, util) {
|
|
|
2606
2705
|
* Asserts that `value` is _not_ an object.
|
|
2607
2706
|
*
|
|
2608
2707
|
* var selection = 'chai'
|
|
2609
|
-
* assert.
|
|
2610
|
-
* assert.
|
|
2708
|
+
* assert.isNotObject(selection, 'tea selection is not an object');
|
|
2709
|
+
* assert.isNotObject(null, 'null is not an object');
|
|
2611
2710
|
*
|
|
2612
2711
|
* @name isNotObject
|
|
2613
2712
|
* @param {Mixed} value
|
|
@@ -2871,19 +2970,7 @@ module.exports = function (chai, util) {
|
|
|
2871
2970
|
*/
|
|
2872
2971
|
|
|
2873
2972
|
assert.include = function (exp, inc, msg) {
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
if (Array.isArray(exp)) {
|
|
2877
|
-
obj.to.include(inc);
|
|
2878
|
-
} else if ('string' === typeof exp) {
|
|
2879
|
-
obj.to.contain.string(inc);
|
|
2880
|
-
} else {
|
|
2881
|
-
throw new chai.AssertionError(
|
|
2882
|
-
'expected an array or string'
|
|
2883
|
-
, null
|
|
2884
|
-
, assert.include
|
|
2885
|
-
);
|
|
2886
|
-
}
|
|
2973
|
+
new Assertion(exp, msg, assert.include).include(inc);
|
|
2887
2974
|
};
|
|
2888
2975
|
|
|
2889
2976
|
/**
|
|
@@ -2903,19 +2990,7 @@ module.exports = function (chai, util) {
|
|
|
2903
2990
|
*/
|
|
2904
2991
|
|
|
2905
2992
|
assert.notInclude = function (exp, inc, msg) {
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
if (Array.isArray(exp)) {
|
|
2909
|
-
obj.to.not.include(inc);
|
|
2910
|
-
} else if ('string' === typeof exp) {
|
|
2911
|
-
obj.to.not.contain.string(inc);
|
|
2912
|
-
} else {
|
|
2913
|
-
throw new chai.AssertionError(
|
|
2914
|
-
'expected an array or string'
|
|
2915
|
-
, null
|
|
2916
|
-
, assert.notInclude
|
|
2917
|
-
);
|
|
2918
|
-
}
|
|
2993
|
+
new Assertion(exp, msg, assert.notInclude).not.include(inc);
|
|
2919
2994
|
};
|
|
2920
2995
|
|
|
2921
2996
|
/**
|
|
@@ -3159,7 +3234,8 @@ module.exports = function (chai, util) {
|
|
|
3159
3234
|
errt = null;
|
|
3160
3235
|
}
|
|
3161
3236
|
|
|
3162
|
-
new Assertion(fn, msg).to.Throw(errt, errs);
|
|
3237
|
+
var assertErr = new Assertion(fn, msg).to.Throw(errt, errs);
|
|
3238
|
+
return flag(assertErr, 'object');
|
|
3163
3239
|
};
|
|
3164
3240
|
|
|
3165
3241
|
/**
|
|
@@ -3244,8 +3320,8 @@ module.exports = function (chai, util) {
|
|
|
3244
3320
|
* assert.sameMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'same members');
|
|
3245
3321
|
*
|
|
3246
3322
|
* @name sameMembers
|
|
3247
|
-
* @param {Array}
|
|
3248
|
-
* @param {Array}
|
|
3323
|
+
* @param {Array} set1
|
|
3324
|
+
* @param {Array} set2
|
|
3249
3325
|
* @param {String} message
|
|
3250
3326
|
* @api public
|
|
3251
3327
|
*/
|
|
@@ -3294,10 +3370,11 @@ module.exports = function (chai, util) {
|
|
|
3294
3370
|
};
|
|
3295
3371
|
|
|
3296
3372
|
});
|
|
3297
|
-
|
|
3373
|
+
|
|
3374
|
+
require.register("chai/lib/chai/interface/expect.js", function (exports, module) {
|
|
3298
3375
|
/*!
|
|
3299
3376
|
* chai
|
|
3300
|
-
* Copyright(c) 2011-
|
|
3377
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
|
3301
3378
|
* MIT Licensed
|
|
3302
3379
|
*/
|
|
3303
3380
|
|
|
@@ -3309,10 +3386,11 @@ module.exports = function (chai, util) {
|
|
|
3309
3386
|
|
|
3310
3387
|
|
|
3311
3388
|
});
|
|
3312
|
-
|
|
3389
|
+
|
|
3390
|
+
require.register("chai/lib/chai/interface/should.js", function (exports, module) {
|
|
3313
3391
|
/*!
|
|
3314
3392
|
* chai
|
|
3315
|
-
* Copyright(c) 2011-
|
|
3393
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
|
3316
3394
|
* MIT Licensed
|
|
3317
3395
|
*/
|
|
3318
3396
|
|
|
@@ -3320,31 +3398,33 @@ module.exports = function (chai, util) {
|
|
|
3320
3398
|
var Assertion = chai.Assertion;
|
|
3321
3399
|
|
|
3322
3400
|
function loadShould () {
|
|
3401
|
+
// explicitly define this method as function as to have it's name to include as `ssfi`
|
|
3402
|
+
function shouldGetter() {
|
|
3403
|
+
if (this instanceof String || this instanceof Number) {
|
|
3404
|
+
return new Assertion(this.constructor(this), null, shouldGetter);
|
|
3405
|
+
} else if (this instanceof Boolean) {
|
|
3406
|
+
return new Assertion(this == true, null, shouldGetter);
|
|
3407
|
+
}
|
|
3408
|
+
return new Assertion(this, null, shouldGetter);
|
|
3409
|
+
}
|
|
3410
|
+
function shouldSetter(value) {
|
|
3411
|
+
// See https://github.com/chaijs/chai/issues/86: this makes
|
|
3412
|
+
// `whatever.should = someValue` actually set `someValue`, which is
|
|
3413
|
+
// especially useful for `global.should = require('chai').should()`.
|
|
3414
|
+
//
|
|
3415
|
+
// Note that we have to use [[DefineProperty]] instead of [[Put]]
|
|
3416
|
+
// since otherwise we would trigger this very setter!
|
|
3417
|
+
Object.defineProperty(this, 'should', {
|
|
3418
|
+
value: value,
|
|
3419
|
+
enumerable: true,
|
|
3420
|
+
configurable: true,
|
|
3421
|
+
writable: true
|
|
3422
|
+
});
|
|
3423
|
+
}
|
|
3323
3424
|
// modify Object.prototype to have `should`
|
|
3324
|
-
Object.defineProperty(Object.prototype, 'should',
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
// See https://github.com/chaijs/chai/issues/86: this makes
|
|
3328
|
-
// `whatever.should = someValue` actually set `someValue`, which is
|
|
3329
|
-
// especially useful for `global.should = require('chai').should()`.
|
|
3330
|
-
//
|
|
3331
|
-
// Note that we have to use [[DefineProperty]] instead of [[Put]]
|
|
3332
|
-
// since otherwise we would trigger this very setter!
|
|
3333
|
-
Object.defineProperty(this, 'should', {
|
|
3334
|
-
value: value,
|
|
3335
|
-
enumerable: true,
|
|
3336
|
-
configurable: true,
|
|
3337
|
-
writable: true
|
|
3338
|
-
});
|
|
3339
|
-
}
|
|
3340
|
-
, get: function(){
|
|
3341
|
-
if (this instanceof String || this instanceof Number) {
|
|
3342
|
-
return new Assertion(this.constructor(this));
|
|
3343
|
-
} else if (this instanceof Boolean) {
|
|
3344
|
-
return new Assertion(this == true);
|
|
3345
|
-
}
|
|
3346
|
-
return new Assertion(this);
|
|
3347
|
-
}
|
|
3425
|
+
Object.defineProperty(Object.prototype, 'should', {
|
|
3426
|
+
set: shouldSetter
|
|
3427
|
+
, get: shouldGetter
|
|
3348
3428
|
, configurable: true
|
|
3349
3429
|
});
|
|
3350
3430
|
|
|
@@ -3388,10 +3468,11 @@ module.exports = function (chai, util) {
|
|
|
3388
3468
|
};
|
|
3389
3469
|
|
|
3390
3470
|
});
|
|
3391
|
-
|
|
3471
|
+
|
|
3472
|
+
require.register("chai/lib/chai/utils/addChainableMethod.js", function (exports, module) {
|
|
3392
3473
|
/*!
|
|
3393
3474
|
* Chai - addChainingMethod utility
|
|
3394
|
-
* Copyright(c) 2012-
|
|
3475
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
3395
3476
|
* MIT Licensed
|
|
3396
3477
|
*/
|
|
3397
3478
|
|
|
@@ -3399,7 +3480,9 @@ require.register("chai/lib/chai/utils/addChainableMethod.js", function(exports,
|
|
|
3399
3480
|
* Module dependencies
|
|
3400
3481
|
*/
|
|
3401
3482
|
|
|
3402
|
-
var transferFlags = require('
|
|
3483
|
+
var transferFlags = require('chai/lib/chai/utils/transferFlags.js');
|
|
3484
|
+
var flag = require('chai/lib/chai/utils/flag.js');
|
|
3485
|
+
var config = require('chai/lib/chai/config.js');
|
|
3403
3486
|
|
|
3404
3487
|
/*!
|
|
3405
3488
|
* Module variables
|
|
@@ -3446,15 +3529,30 @@ var call = Function.prototype.call,
|
|
|
3446
3529
|
*/
|
|
3447
3530
|
|
|
3448
3531
|
module.exports = function (ctx, name, method, chainingBehavior) {
|
|
3449
|
-
if (typeof chainingBehavior !== 'function')
|
|
3532
|
+
if (typeof chainingBehavior !== 'function') {
|
|
3450
3533
|
chainingBehavior = function () { };
|
|
3534
|
+
}
|
|
3535
|
+
|
|
3536
|
+
var chainableBehavior = {
|
|
3537
|
+
method: method
|
|
3538
|
+
, chainingBehavior: chainingBehavior
|
|
3539
|
+
};
|
|
3540
|
+
|
|
3541
|
+
// save the methods so we can overwrite them later, if we need to.
|
|
3542
|
+
if (!ctx.__methods) {
|
|
3543
|
+
ctx.__methods = {};
|
|
3544
|
+
}
|
|
3545
|
+
ctx.__methods[name] = chainableBehavior;
|
|
3451
3546
|
|
|
3452
3547
|
Object.defineProperty(ctx, name,
|
|
3453
3548
|
{ get: function () {
|
|
3454
|
-
chainingBehavior.call(this);
|
|
3549
|
+
chainableBehavior.chainingBehavior.call(this);
|
|
3455
3550
|
|
|
3456
|
-
var assert = function () {
|
|
3457
|
-
var
|
|
3551
|
+
var assert = function assert() {
|
|
3552
|
+
var old_ssfi = flag(this, 'ssfi');
|
|
3553
|
+
if (old_ssfi && config.includeStack === false)
|
|
3554
|
+
flag(this, 'ssfi', assert);
|
|
3555
|
+
var result = chainableBehavior.method.apply(this, arguments);
|
|
3458
3556
|
return result === undefined ? this : result;
|
|
3459
3557
|
};
|
|
3460
3558
|
|
|
@@ -3485,13 +3583,16 @@ module.exports = function (ctx, name, method, chainingBehavior) {
|
|
|
3485
3583
|
};
|
|
3486
3584
|
|
|
3487
3585
|
});
|
|
3488
|
-
|
|
3586
|
+
|
|
3587
|
+
require.register("chai/lib/chai/utils/addMethod.js", function (exports, module) {
|
|
3489
3588
|
/*!
|
|
3490
3589
|
* Chai - addMethod utility
|
|
3491
|
-
* Copyright(c) 2012-
|
|
3590
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
3492
3591
|
* MIT Licensed
|
|
3493
3592
|
*/
|
|
3494
3593
|
|
|
3594
|
+
var config = require('chai/lib/chai/config.js');
|
|
3595
|
+
|
|
3495
3596
|
/**
|
|
3496
3597
|
* ### .addMethod (ctx, name, method)
|
|
3497
3598
|
*
|
|
@@ -3516,19 +3617,24 @@ require.register("chai/lib/chai/utils/addMethod.js", function(exports, require,
|
|
|
3516
3617
|
* @name addMethod
|
|
3517
3618
|
* @api public
|
|
3518
3619
|
*/
|
|
3620
|
+
var flag = require('chai/lib/chai/utils/flag.js');
|
|
3519
3621
|
|
|
3520
3622
|
module.exports = function (ctx, name, method) {
|
|
3521
3623
|
ctx[name] = function () {
|
|
3624
|
+
var old_ssfi = flag(this, 'ssfi');
|
|
3625
|
+
if (old_ssfi && config.includeStack === false)
|
|
3626
|
+
flag(this, 'ssfi', ctx[name]);
|
|
3522
3627
|
var result = method.apply(this, arguments);
|
|
3523
3628
|
return result === undefined ? this : result;
|
|
3524
3629
|
};
|
|
3525
3630
|
};
|
|
3526
3631
|
|
|
3527
3632
|
});
|
|
3528
|
-
|
|
3633
|
+
|
|
3634
|
+
require.register("chai/lib/chai/utils/addProperty.js", function (exports, module) {
|
|
3529
3635
|
/*!
|
|
3530
3636
|
* Chai - addProperty utility
|
|
3531
|
-
* Copyright(c) 2012-
|
|
3637
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
3532
3638
|
* MIT Licensed
|
|
3533
3639
|
*/
|
|
3534
3640
|
|
|
@@ -3568,10 +3674,11 @@ module.exports = function (ctx, name, getter) {
|
|
|
3568
3674
|
};
|
|
3569
3675
|
|
|
3570
3676
|
});
|
|
3571
|
-
|
|
3677
|
+
|
|
3678
|
+
require.register("chai/lib/chai/utils/flag.js", function (exports, module) {
|
|
3572
3679
|
/*!
|
|
3573
3680
|
* Chai - flag utility
|
|
3574
|
-
* Copyright(c) 2012-
|
|
3681
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
3575
3682
|
* MIT Licensed
|
|
3576
3683
|
*/
|
|
3577
3684
|
|
|
@@ -3603,10 +3710,11 @@ module.exports = function (obj, key, value) {
|
|
|
3603
3710
|
};
|
|
3604
3711
|
|
|
3605
3712
|
});
|
|
3606
|
-
|
|
3713
|
+
|
|
3714
|
+
require.register("chai/lib/chai/utils/getActual.js", function (exports, module) {
|
|
3607
3715
|
/*!
|
|
3608
3716
|
* Chai - getActual utility
|
|
3609
|
-
* Copyright(c) 2012-
|
|
3717
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
3610
3718
|
* MIT Licensed
|
|
3611
3719
|
*/
|
|
3612
3720
|
|
|
@@ -3620,15 +3728,15 @@ require.register("chai/lib/chai/utils/getActual.js", function(exports, require,
|
|
|
3620
3728
|
*/
|
|
3621
3729
|
|
|
3622
3730
|
module.exports = function (obj, args) {
|
|
3623
|
-
|
|
3624
|
-
return 'undefined' !== typeof actual ? actual : obj._obj;
|
|
3731
|
+
return args.length > 4 ? args[4] : obj._obj;
|
|
3625
3732
|
};
|
|
3626
3733
|
|
|
3627
3734
|
});
|
|
3628
|
-
|
|
3735
|
+
|
|
3736
|
+
require.register("chai/lib/chai/utils/getEnumerableProperties.js", function (exports, module) {
|
|
3629
3737
|
/*!
|
|
3630
3738
|
* Chai - getEnumerableProperties utility
|
|
3631
|
-
* Copyright(c) 2012-
|
|
3739
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
3632
3740
|
* MIT Licensed
|
|
3633
3741
|
*/
|
|
3634
3742
|
|
|
@@ -3653,10 +3761,11 @@ module.exports = function getEnumerableProperties(object) {
|
|
|
3653
3761
|
};
|
|
3654
3762
|
|
|
3655
3763
|
});
|
|
3656
|
-
|
|
3764
|
+
|
|
3765
|
+
require.register("chai/lib/chai/utils/getMessage.js", function (exports, module) {
|
|
3657
3766
|
/*!
|
|
3658
3767
|
* Chai - message composition utility
|
|
3659
|
-
* Copyright(c) 2012-
|
|
3768
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
3660
3769
|
* MIT Licensed
|
|
3661
3770
|
*/
|
|
3662
3771
|
|
|
@@ -3664,10 +3773,10 @@ require.register("chai/lib/chai/utils/getMessage.js", function(exports, require,
|
|
|
3664
3773
|
* Module dependancies
|
|
3665
3774
|
*/
|
|
3666
3775
|
|
|
3667
|
-
var flag = require('
|
|
3668
|
-
, getActual = require('
|
|
3669
|
-
, inspect = require('
|
|
3670
|
-
, objDisplay = require('
|
|
3776
|
+
var flag = require('chai/lib/chai/utils/flag.js')
|
|
3777
|
+
, getActual = require('chai/lib/chai/utils/getActual.js')
|
|
3778
|
+
, inspect = require('chai/lib/chai/utils/inspect.js')
|
|
3779
|
+
, objDisplay = require('chai/lib/chai/utils/objDisplay.js');
|
|
3671
3780
|
|
|
3672
3781
|
/**
|
|
3673
3782
|
* ### .getMessage(object, message, negateMessage)
|
|
@@ -3695,6 +3804,7 @@ module.exports = function (obj, args) {
|
|
|
3695
3804
|
, msg = negate ? args[2] : args[1]
|
|
3696
3805
|
, flagMsg = flag(obj, 'message');
|
|
3697
3806
|
|
|
3807
|
+
if(typeof msg === "function") msg = msg();
|
|
3698
3808
|
msg = msg || '';
|
|
3699
3809
|
msg = msg
|
|
3700
3810
|
.replace(/#{this}/g, objDisplay(val))
|
|
@@ -3705,10 +3815,11 @@ module.exports = function (obj, args) {
|
|
|
3705
3815
|
};
|
|
3706
3816
|
|
|
3707
3817
|
});
|
|
3708
|
-
|
|
3818
|
+
|
|
3819
|
+
require.register("chai/lib/chai/utils/getName.js", function (exports, module) {
|
|
3709
3820
|
/*!
|
|
3710
3821
|
* Chai - getName utility
|
|
3711
|
-
* Copyright(c) 2012-
|
|
3822
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
3712
3823
|
* MIT Licensed
|
|
3713
3824
|
*/
|
|
3714
3825
|
|
|
@@ -3728,10 +3839,11 @@ module.exports = function (func) {
|
|
|
3728
3839
|
};
|
|
3729
3840
|
|
|
3730
3841
|
});
|
|
3731
|
-
|
|
3842
|
+
|
|
3843
|
+
require.register("chai/lib/chai/utils/getPathValue.js", function (exports, module) {
|
|
3732
3844
|
/*!
|
|
3733
3845
|
* Chai - getPathValue utility
|
|
3734
|
-
* Copyright(c) 2012-
|
|
3846
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
3735
3847
|
* @see https://github.com/logicalparadox/filtr
|
|
3736
3848
|
* MIT Licensed
|
|
3737
3849
|
*/
|
|
@@ -3833,10 +3945,11 @@ function _getPathValue (parsed, obj) {
|
|
|
3833
3945
|
};
|
|
3834
3946
|
|
|
3835
3947
|
});
|
|
3836
|
-
|
|
3948
|
+
|
|
3949
|
+
require.register("chai/lib/chai/utils/getProperties.js", function (exports, module) {
|
|
3837
3950
|
/*!
|
|
3838
3951
|
* Chai - getProperties utility
|
|
3839
|
-
* Copyright(c) 2012-
|
|
3952
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
3840
3953
|
* MIT Licensed
|
|
3841
3954
|
*/
|
|
3842
3955
|
|
|
@@ -3871,7 +3984,8 @@ module.exports = function getProperties(object) {
|
|
|
3871
3984
|
};
|
|
3872
3985
|
|
|
3873
3986
|
});
|
|
3874
|
-
|
|
3987
|
+
|
|
3988
|
+
require.register("chai/lib/chai/utils/index.js", function (exports, module) {
|
|
3875
3989
|
/*!
|
|
3876
3990
|
* chai
|
|
3877
3991
|
* Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -3888,107 +4002,114 @@ var exports = module.exports = {};
|
|
|
3888
4002
|
* test utility
|
|
3889
4003
|
*/
|
|
3890
4004
|
|
|
3891
|
-
exports.test = require('
|
|
4005
|
+
exports.test = require('chai/lib/chai/utils/test.js');
|
|
3892
4006
|
|
|
3893
4007
|
/*!
|
|
3894
4008
|
* type utility
|
|
3895
4009
|
*/
|
|
3896
4010
|
|
|
3897
|
-
exports.type = require('
|
|
4011
|
+
exports.type = require('chai/lib/chai/utils/type.js');
|
|
3898
4012
|
|
|
3899
4013
|
/*!
|
|
3900
4014
|
* message utility
|
|
3901
4015
|
*/
|
|
3902
4016
|
|
|
3903
|
-
exports.getMessage = require('
|
|
4017
|
+
exports.getMessage = require('chai/lib/chai/utils/getMessage.js');
|
|
3904
4018
|
|
|
3905
4019
|
/*!
|
|
3906
4020
|
* actual utility
|
|
3907
4021
|
*/
|
|
3908
4022
|
|
|
3909
|
-
exports.getActual = require('
|
|
4023
|
+
exports.getActual = require('chai/lib/chai/utils/getActual.js');
|
|
3910
4024
|
|
|
3911
4025
|
/*!
|
|
3912
4026
|
* Inspect util
|
|
3913
4027
|
*/
|
|
3914
4028
|
|
|
3915
|
-
exports.inspect = require('
|
|
4029
|
+
exports.inspect = require('chai/lib/chai/utils/inspect.js');
|
|
3916
4030
|
|
|
3917
4031
|
/*!
|
|
3918
4032
|
* Object Display util
|
|
3919
4033
|
*/
|
|
3920
4034
|
|
|
3921
|
-
exports.objDisplay = require('
|
|
4035
|
+
exports.objDisplay = require('chai/lib/chai/utils/objDisplay.js');
|
|
3922
4036
|
|
|
3923
4037
|
/*!
|
|
3924
4038
|
* Flag utility
|
|
3925
4039
|
*/
|
|
3926
4040
|
|
|
3927
|
-
exports.flag = require('
|
|
4041
|
+
exports.flag = require('chai/lib/chai/utils/flag.js');
|
|
3928
4042
|
|
|
3929
4043
|
/*!
|
|
3930
4044
|
* Flag transferring utility
|
|
3931
4045
|
*/
|
|
3932
4046
|
|
|
3933
|
-
exports.transferFlags = require('
|
|
4047
|
+
exports.transferFlags = require('chai/lib/chai/utils/transferFlags.js');
|
|
3934
4048
|
|
|
3935
4049
|
/*!
|
|
3936
4050
|
* Deep equal utility
|
|
3937
4051
|
*/
|
|
3938
4052
|
|
|
3939
|
-
exports.eql = require('deep-eql');
|
|
4053
|
+
exports.eql = require('chaijs~deep-eql@0.1.3');
|
|
3940
4054
|
|
|
3941
4055
|
/*!
|
|
3942
4056
|
* Deep path value
|
|
3943
4057
|
*/
|
|
3944
4058
|
|
|
3945
|
-
exports.getPathValue = require('
|
|
4059
|
+
exports.getPathValue = require('chai/lib/chai/utils/getPathValue.js');
|
|
3946
4060
|
|
|
3947
4061
|
/*!
|
|
3948
4062
|
* Function name
|
|
3949
4063
|
*/
|
|
3950
4064
|
|
|
3951
|
-
exports.getName = require('
|
|
4065
|
+
exports.getName = require('chai/lib/chai/utils/getName.js');
|
|
3952
4066
|
|
|
3953
4067
|
/*!
|
|
3954
4068
|
* add Property
|
|
3955
4069
|
*/
|
|
3956
4070
|
|
|
3957
|
-
exports.addProperty = require('
|
|
4071
|
+
exports.addProperty = require('chai/lib/chai/utils/addProperty.js');
|
|
3958
4072
|
|
|
3959
4073
|
/*!
|
|
3960
4074
|
* add Method
|
|
3961
4075
|
*/
|
|
3962
4076
|
|
|
3963
|
-
exports.addMethod = require('
|
|
4077
|
+
exports.addMethod = require('chai/lib/chai/utils/addMethod.js');
|
|
3964
4078
|
|
|
3965
4079
|
/*!
|
|
3966
4080
|
* overwrite Property
|
|
3967
4081
|
*/
|
|
3968
4082
|
|
|
3969
|
-
exports.overwriteProperty = require('
|
|
4083
|
+
exports.overwriteProperty = require('chai/lib/chai/utils/overwriteProperty.js');
|
|
3970
4084
|
|
|
3971
4085
|
/*!
|
|
3972
4086
|
* overwrite Method
|
|
3973
4087
|
*/
|
|
3974
4088
|
|
|
3975
|
-
exports.overwriteMethod = require('
|
|
4089
|
+
exports.overwriteMethod = require('chai/lib/chai/utils/overwriteMethod.js');
|
|
3976
4090
|
|
|
3977
4091
|
/*!
|
|
3978
4092
|
* Add a chainable method
|
|
3979
4093
|
*/
|
|
3980
4094
|
|
|
3981
|
-
exports.addChainableMethod = require('
|
|
4095
|
+
exports.addChainableMethod = require('chai/lib/chai/utils/addChainableMethod.js');
|
|
4096
|
+
|
|
4097
|
+
/*!
|
|
4098
|
+
* Overwrite chainable method
|
|
4099
|
+
*/
|
|
4100
|
+
|
|
4101
|
+
exports.overwriteChainableMethod = require('chai/lib/chai/utils/overwriteChainableMethod.js');
|
|
3982
4102
|
|
|
3983
4103
|
|
|
3984
4104
|
});
|
|
3985
|
-
|
|
4105
|
+
|
|
4106
|
+
require.register("chai/lib/chai/utils/inspect.js", function (exports, module) {
|
|
3986
4107
|
// This is (almost) directly from Node.js utils
|
|
3987
4108
|
// https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js
|
|
3988
4109
|
|
|
3989
|
-
var getName = require('
|
|
3990
|
-
var getProperties = require('
|
|
3991
|
-
var getEnumerableProperties = require('
|
|
4110
|
+
var getName = require('chai/lib/chai/utils/getName.js');
|
|
4111
|
+
var getProperties = require('chai/lib/chai/utils/getProperties.js');
|
|
4112
|
+
var getEnumerableProperties = require('chai/lib/chai/utils/getEnumerableProperties.js');
|
|
3992
4113
|
|
|
3993
4114
|
module.exports = inspect;
|
|
3994
4115
|
|
|
@@ -4012,24 +4133,6 @@ function inspect(obj, showHidden, depth, colors) {
|
|
|
4012
4133
|
return formatValue(ctx, obj, (typeof depth === 'undefined' ? 2 : depth));
|
|
4013
4134
|
}
|
|
4014
4135
|
|
|
4015
|
-
// https://gist.github.com/1044128/
|
|
4016
|
-
var getOuterHTML = function(element) {
|
|
4017
|
-
if ('outerHTML' in element) return element.outerHTML;
|
|
4018
|
-
var ns = "http://www.w3.org/1999/xhtml";
|
|
4019
|
-
var container = document.createElementNS(ns, '_');
|
|
4020
|
-
var elemProto = (window.HTMLElement || window.Element).prototype;
|
|
4021
|
-
var xmlSerializer = new XMLSerializer();
|
|
4022
|
-
var html;
|
|
4023
|
-
if (document.xmlVersion) {
|
|
4024
|
-
return xmlSerializer.serializeToString(element);
|
|
4025
|
-
} else {
|
|
4026
|
-
container.appendChild(element.cloneNode(false));
|
|
4027
|
-
html = container.innerHTML.replace('><', '>' + element.innerHTML + '<');
|
|
4028
|
-
container.innerHTML = '';
|
|
4029
|
-
return html;
|
|
4030
|
-
}
|
|
4031
|
-
};
|
|
4032
|
-
|
|
4033
4136
|
// Returns true if object is a DOM element.
|
|
4034
4137
|
var isDOMElement = function (object) {
|
|
4035
4138
|
if (typeof HTMLElement === 'object') {
|
|
@@ -4063,9 +4166,37 @@ function formatValue(ctx, value, recurseTimes) {
|
|
|
4063
4166
|
return primitive;
|
|
4064
4167
|
}
|
|
4065
4168
|
|
|
4066
|
-
// If
|
|
4169
|
+
// If this is a DOM element, try to get the outer HTML.
|
|
4067
4170
|
if (isDOMElement(value)) {
|
|
4068
|
-
|
|
4171
|
+
if ('outerHTML' in value) {
|
|
4172
|
+
return value.outerHTML;
|
|
4173
|
+
// This value does not have an outerHTML attribute,
|
|
4174
|
+
// it could still be an XML element
|
|
4175
|
+
} else {
|
|
4176
|
+
// Attempt to serialize it
|
|
4177
|
+
try {
|
|
4178
|
+
if (document.xmlVersion) {
|
|
4179
|
+
var xmlSerializer = new XMLSerializer();
|
|
4180
|
+
return xmlSerializer.serializeToString(value);
|
|
4181
|
+
} else {
|
|
4182
|
+
// Firefox 11- do not support outerHTML
|
|
4183
|
+
// It does, however, support innerHTML
|
|
4184
|
+
// Use the following to render the element
|
|
4185
|
+
var ns = "http://www.w3.org/1999/xhtml";
|
|
4186
|
+
var container = document.createElementNS(ns, '_');
|
|
4187
|
+
|
|
4188
|
+
container.appendChild(value.cloneNode(false));
|
|
4189
|
+
html = container.innerHTML
|
|
4190
|
+
.replace('><', '>' + value.innerHTML + '<');
|
|
4191
|
+
container.innerHTML = '';
|
|
4192
|
+
return html;
|
|
4193
|
+
}
|
|
4194
|
+
} catch (err) {
|
|
4195
|
+
// This could be a non-native DOM implementation,
|
|
4196
|
+
// continue with the normal flow:
|
|
4197
|
+
// printing the element as if it is an object.
|
|
4198
|
+
}
|
|
4199
|
+
}
|
|
4069
4200
|
}
|
|
4070
4201
|
|
|
4071
4202
|
// Look up the keys of the object.
|
|
@@ -4166,6 +4297,9 @@ function formatPrimitive(ctx, value) {
|
|
|
4166
4297
|
return ctx.stylize(simple, 'string');
|
|
4167
4298
|
|
|
4168
4299
|
case 'number':
|
|
4300
|
+
if (value === 0 && (1/value) === -Infinity) {
|
|
4301
|
+
return ctx.stylize('-0', 'number');
|
|
4302
|
+
}
|
|
4169
4303
|
return ctx.stylize('' + value, 'number');
|
|
4170
4304
|
|
|
4171
4305
|
case 'boolean':
|
|
@@ -4305,10 +4439,11 @@ function objectToString(o) {
|
|
|
4305
4439
|
}
|
|
4306
4440
|
|
|
4307
4441
|
});
|
|
4308
|
-
|
|
4442
|
+
|
|
4443
|
+
require.register("chai/lib/chai/utils/objDisplay.js", function (exports, module) {
|
|
4309
4444
|
/*!
|
|
4310
4445
|
* Chai - flag utility
|
|
4311
|
-
* Copyright(c) 2012-
|
|
4446
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
4312
4447
|
* MIT Licensed
|
|
4313
4448
|
*/
|
|
4314
4449
|
|
|
@@ -4316,7 +4451,8 @@ require.register("chai/lib/chai/utils/objDisplay.js", function(exports, require,
|
|
|
4316
4451
|
* Module dependancies
|
|
4317
4452
|
*/
|
|
4318
4453
|
|
|
4319
|
-
var inspect = require('
|
|
4454
|
+
var inspect = require('chai/lib/chai/utils/inspect.js');
|
|
4455
|
+
var config = require('chai/lib/chai/config.js');
|
|
4320
4456
|
|
|
4321
4457
|
/**
|
|
4322
4458
|
* ### .objDisplay (object)
|
|
@@ -4334,7 +4470,7 @@ module.exports = function (obj) {
|
|
|
4334
4470
|
var str = inspect(obj)
|
|
4335
4471
|
, type = Object.prototype.toString.call(obj);
|
|
4336
4472
|
|
|
4337
|
-
if (str.length >=
|
|
4473
|
+
if (config.truncateThreshold && str.length >= config.truncateThreshold) {
|
|
4338
4474
|
if (type === '[object Function]') {
|
|
4339
4475
|
return !obj.name || obj.name === ''
|
|
4340
4476
|
? '[Function]'
|
|
@@ -4356,10 +4492,11 @@ module.exports = function (obj) {
|
|
|
4356
4492
|
};
|
|
4357
4493
|
|
|
4358
4494
|
});
|
|
4359
|
-
|
|
4495
|
+
|
|
4496
|
+
require.register("chai/lib/chai/utils/overwriteMethod.js", function (exports, module) {
|
|
4360
4497
|
/*!
|
|
4361
4498
|
* Chai - overwriteMethod utility
|
|
4362
|
-
* Copyright(c) 2012-
|
|
4499
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
4363
4500
|
* MIT Licensed
|
|
4364
4501
|
*/
|
|
4365
4502
|
|
|
@@ -4410,10 +4547,11 @@ module.exports = function (ctx, name, method) {
|
|
|
4410
4547
|
};
|
|
4411
4548
|
|
|
4412
4549
|
});
|
|
4413
|
-
|
|
4550
|
+
|
|
4551
|
+
require.register("chai/lib/chai/utils/overwriteProperty.js", function (exports, module) {
|
|
4414
4552
|
/*!
|
|
4415
4553
|
* Chai - overwriteProperty utility
|
|
4416
|
-
* Copyright(c) 2012-
|
|
4554
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
4417
4555
|
* MIT Licensed
|
|
4418
4556
|
*/
|
|
4419
4557
|
|
|
@@ -4467,10 +4605,68 @@ module.exports = function (ctx, name, getter) {
|
|
|
4467
4605
|
};
|
|
4468
4606
|
|
|
4469
4607
|
});
|
|
4470
|
-
|
|
4608
|
+
|
|
4609
|
+
require.register("chai/lib/chai/utils/overwriteChainableMethod.js", function (exports, module) {
|
|
4610
|
+
/*!
|
|
4611
|
+
* Chai - overwriteChainableMethod utility
|
|
4612
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
4613
|
+
* MIT Licensed
|
|
4614
|
+
*/
|
|
4615
|
+
|
|
4616
|
+
/**
|
|
4617
|
+
* ### overwriteChainableMethod (ctx, name, fn)
|
|
4618
|
+
*
|
|
4619
|
+
* Overwites an already existing chainable method
|
|
4620
|
+
* and provides access to the previous function or
|
|
4621
|
+
* property. Must return functions to be used for
|
|
4622
|
+
* name.
|
|
4623
|
+
*
|
|
4624
|
+
* utils.overwriteChainableMethod(chai.Assertion.prototype, 'length',
|
|
4625
|
+
* function (_super) {
|
|
4626
|
+
* }
|
|
4627
|
+
* , function (_super) {
|
|
4628
|
+
* }
|
|
4629
|
+
* );
|
|
4630
|
+
*
|
|
4631
|
+
* Can also be accessed directly from `chai.Assertion`.
|
|
4632
|
+
*
|
|
4633
|
+
* chai.Assertion.overwriteChainableMethod('foo', fn, fn);
|
|
4634
|
+
*
|
|
4635
|
+
* Then can be used as any other assertion.
|
|
4636
|
+
*
|
|
4637
|
+
* expect(myFoo).to.have.length(3);
|
|
4638
|
+
* expect(myFoo).to.have.length.above(3);
|
|
4639
|
+
*
|
|
4640
|
+
* @param {Object} ctx object whose method / property is to be overwritten
|
|
4641
|
+
* @param {String} name of method / property to overwrite
|
|
4642
|
+
* @param {Function} method function that returns a function to be used for name
|
|
4643
|
+
* @param {Function} chainingBehavior function that returns a function to be used for property
|
|
4644
|
+
* @name overwriteChainableMethod
|
|
4645
|
+
* @api public
|
|
4646
|
+
*/
|
|
4647
|
+
|
|
4648
|
+
module.exports = function (ctx, name, method, chainingBehavior) {
|
|
4649
|
+
var chainableBehavior = ctx.__methods[name];
|
|
4650
|
+
|
|
4651
|
+
var _chainingBehavior = chainableBehavior.chainingBehavior;
|
|
4652
|
+
chainableBehavior.chainingBehavior = function () {
|
|
4653
|
+
var result = chainingBehavior(_chainingBehavior).call(this);
|
|
4654
|
+
return result === undefined ? this : result;
|
|
4655
|
+
};
|
|
4656
|
+
|
|
4657
|
+
var _method = chainableBehavior.method;
|
|
4658
|
+
chainableBehavior.method = function () {
|
|
4659
|
+
var result = method(_method).apply(this, arguments);
|
|
4660
|
+
return result === undefined ? this : result;
|
|
4661
|
+
};
|
|
4662
|
+
};
|
|
4663
|
+
|
|
4664
|
+
});
|
|
4665
|
+
|
|
4666
|
+
require.register("chai/lib/chai/utils/test.js", function (exports, module) {
|
|
4471
4667
|
/*!
|
|
4472
4668
|
* Chai - test utility
|
|
4473
|
-
* Copyright(c) 2012-
|
|
4669
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
4474
4670
|
* MIT Licensed
|
|
4475
4671
|
*/
|
|
4476
4672
|
|
|
@@ -4478,7 +4674,7 @@ require.register("chai/lib/chai/utils/test.js", function(exports, require, modul
|
|
|
4478
4674
|
* Module dependancies
|
|
4479
4675
|
*/
|
|
4480
4676
|
|
|
4481
|
-
var flag = require('
|
|
4677
|
+
var flag = require('chai/lib/chai/utils/flag.js');
|
|
4482
4678
|
|
|
4483
4679
|
/**
|
|
4484
4680
|
* # test(object, expression)
|
|
@@ -4496,10 +4692,11 @@ module.exports = function (obj, args) {
|
|
|
4496
4692
|
};
|
|
4497
4693
|
|
|
4498
4694
|
});
|
|
4499
|
-
|
|
4695
|
+
|
|
4696
|
+
require.register("chai/lib/chai/utils/transferFlags.js", function (exports, module) {
|
|
4500
4697
|
/*!
|
|
4501
4698
|
* Chai - transferFlags utility
|
|
4502
|
-
* Copyright(c) 2012-
|
|
4699
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
4503
4700
|
* MIT Licensed
|
|
4504
4701
|
*/
|
|
4505
4702
|
|
|
@@ -4543,10 +4740,11 @@ module.exports = function (assertion, object, includeAll) {
|
|
|
4543
4740
|
};
|
|
4544
4741
|
|
|
4545
4742
|
});
|
|
4546
|
-
|
|
4743
|
+
|
|
4744
|
+
require.register("chai/lib/chai/utils/type.js", function (exports, module) {
|
|
4547
4745
|
/*!
|
|
4548
4746
|
* Chai - type utility
|
|
4549
|
-
* Copyright(c) 2012-
|
|
4747
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
4550
4748
|
* MIT Licensed
|
|
4551
4749
|
*/
|
|
4552
4750
|
|
|
@@ -4592,22 +4790,11 @@ module.exports = function (obj) {
|
|
|
4592
4790
|
|
|
4593
4791
|
});
|
|
4594
4792
|
|
|
4595
|
-
|
|
4596
|
-
require.alias("chaijs-assertion-error/index.js", "chai/deps/assertion-error/index.js");
|
|
4597
|
-
require.alias("chaijs-assertion-error/index.js", "chai/deps/assertion-error/index.js");
|
|
4598
|
-
require.alias("chaijs-assertion-error/index.js", "assertion-error/index.js");
|
|
4599
|
-
require.alias("chaijs-assertion-error/index.js", "chaijs-assertion-error/index.js");
|
|
4600
|
-
require.alias("chaijs-deep-eql/lib/eql.js", "chai/deps/deep-eql/lib/eql.js");
|
|
4601
|
-
require.alias("chaijs-deep-eql/lib/eql.js", "chai/deps/deep-eql/index.js");
|
|
4602
|
-
require.alias("chaijs-deep-eql/lib/eql.js", "deep-eql/index.js");
|
|
4603
|
-
require.alias("chaijs-type-detect/lib/type.js", "chaijs-deep-eql/deps/type-detect/lib/type.js");
|
|
4604
|
-
require.alias("chaijs-type-detect/lib/type.js", "chaijs-deep-eql/deps/type-detect/index.js");
|
|
4605
|
-
require.alias("chaijs-type-detect/lib/type.js", "chaijs-type-detect/index.js");
|
|
4606
|
-
require.alias("chaijs-deep-eql/lib/eql.js", "chaijs-deep-eql/index.js");
|
|
4607
|
-
require.alias("chai/index.js", "chai/index.js");if (typeof exports == "object") {
|
|
4793
|
+
if (typeof exports == "object") {
|
|
4608
4794
|
module.exports = require("chai");
|
|
4609
4795
|
} else if (typeof define == "function" && define.amd) {
|
|
4610
|
-
define(function(){ return require("chai"); });
|
|
4796
|
+
define("chai", [], function(){ return require("chai"); });
|
|
4611
4797
|
} else {
|
|
4612
|
-
this["chai"] = require("chai");
|
|
4613
|
-
}
|
|
4798
|
+
(this || window)["chai"] = require("chai");
|
|
4799
|
+
}
|
|
4800
|
+
})()
|