konacha-chai-matchers 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSIONS +5 -5
- data/lib/konacha-chai-matchers/library.rb +4 -0
- data/lib/konacha-chai-matchers/version.rb +1 -1
- data/vendor/assets/javascripts/chai-as-promised.js +286 -324
- data/vendor/assets/javascripts/chai-changes.js +14 -6
- data/vendor/assets/javascripts/chai-jquery.js +23 -3
- data/vendor/assets/javascripts/mocha-as-promised.js +11 -4
- data/vendor/assets/javascripts/sinon.js +485 -283
- metadata +21 -29
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Sinon.JS 1.7.3, 2013/
|
2
|
+
* Sinon.JS 1.7.3, 2013/12/11
|
3
3
|
*
|
4
4
|
* @author Christian Johansen (christian@cjohansen.no)
|
5
5
|
* @author Contributors: https://github.com/cjohansen/Sinon.JS/blob/master/AUTHORS
|
@@ -97,26 +97,37 @@ var sinon = (function (buster) {
|
|
97
97
|
throw new TypeError("Method wrapper should be function");
|
98
98
|
}
|
99
99
|
|
100
|
-
var wrappedMethod = object[property]
|
100
|
+
var wrappedMethod = object[property],
|
101
|
+
error;
|
101
102
|
|
102
103
|
if (!isFunction(wrappedMethod)) {
|
103
|
-
|
104
|
+
error = new TypeError("Attempted to wrap " + (typeof wrappedMethod) + " property " +
|
104
105
|
property + " as function");
|
105
106
|
}
|
106
107
|
|
107
108
|
if (wrappedMethod.restore && wrappedMethod.restore.sinon) {
|
108
|
-
|
109
|
+
error = new TypeError("Attempted to wrap " + property + " which is already wrapped");
|
109
110
|
}
|
110
111
|
|
111
112
|
if (wrappedMethod.calledBefore) {
|
112
113
|
var verb = !!wrappedMethod.returns ? "stubbed" : "spied on";
|
113
|
-
|
114
|
+
error = new TypeError("Attempted to wrap " + property + " which is already " + verb);
|
115
|
+
}
|
116
|
+
|
117
|
+
if (error) {
|
118
|
+
if (wrappedMethod._stack) {
|
119
|
+
error.stack += '\n--------------\n' + wrappedMethod._stack;
|
120
|
+
}
|
121
|
+
throw error;
|
114
122
|
}
|
115
123
|
|
116
124
|
// IE 8 does not support hasOwnProperty on the window object.
|
117
125
|
var owned = hasOwn.call(object, property);
|
118
126
|
object[property] = method;
|
119
127
|
method.displayName = property;
|
128
|
+
// Set up a stack trace which can be used later to find what line of
|
129
|
+
// code the original method was created on.
|
130
|
+
method._stack = (new Error('Stack Trace for original')).stack;
|
120
131
|
|
121
132
|
method.restore = function () {
|
122
133
|
// For prototype properties try to reset by delete first.
|
@@ -185,26 +196,16 @@ var sinon = (function (buster) {
|
|
185
196
|
return false;
|
186
197
|
}
|
187
198
|
|
188
|
-
if (aString == "[object Array]") {
|
189
|
-
if (a.length !== b.length) {
|
190
|
-
return false;
|
191
|
-
}
|
192
|
-
|
193
|
-
for (var i = 0, l = a.length; i < l; i += 1) {
|
194
|
-
if (!deepEqual(a[i], b[i])) {
|
195
|
-
return false;
|
196
|
-
}
|
197
|
-
}
|
198
|
-
|
199
|
-
return true;
|
200
|
-
}
|
201
|
-
|
202
199
|
if (aString == "[object Date]") {
|
203
200
|
return a.valueOf() === b.valueOf();
|
204
201
|
}
|
205
202
|
|
206
203
|
var prop, aLength = 0, bLength = 0;
|
207
204
|
|
205
|
+
if (aString == "[object Array]" && a.length !== b.length) {
|
206
|
+
return false;
|
207
|
+
}
|
208
|
+
|
208
209
|
for (prop in a) {
|
209
210
|
aLength += 1;
|
210
211
|
|
@@ -353,15 +354,21 @@ var sinon = (function (buster) {
|
|
353
354
|
}
|
354
355
|
};
|
355
356
|
|
356
|
-
var isNode = typeof module
|
357
|
+
var isNode = typeof module !== "undefined" && module.exports;
|
358
|
+
var isAMD = typeof define === 'function' && typeof define.amd === 'object' && define.amd;
|
357
359
|
|
358
|
-
if (
|
360
|
+
if (isAMD) {
|
361
|
+
define(function(){
|
362
|
+
return sinon;
|
363
|
+
});
|
364
|
+
} else if (isNode) {
|
359
365
|
try {
|
360
366
|
buster = { format: require("buster-format") };
|
361
367
|
} catch (e) {}
|
362
368
|
module.exports = sinon;
|
363
369
|
module.exports.spy = require("./sinon/spy");
|
364
370
|
module.exports.spyCall = require("./sinon/call");
|
371
|
+
module.exports.behavior = require("./sinon/behavior");
|
365
372
|
module.exports.stub = require("./sinon/stub");
|
366
373
|
module.exports.mock = require("./sinon/mock");
|
367
374
|
module.exports.collection = require("./sinon/collection");
|
@@ -407,7 +414,7 @@ var sinon = (function (buster) {
|
|
407
414
|
*/
|
408
415
|
|
409
416
|
(function (sinon) {
|
410
|
-
var commonJSModule = typeof module
|
417
|
+
var commonJSModule = typeof module !== 'undefined' && module.exports;
|
411
418
|
|
412
419
|
if (!sinon && commonJSModule) {
|
413
420
|
sinon = require("../sinon");
|
@@ -651,7 +658,7 @@ var sinon = (function (buster) {
|
|
651
658
|
*/
|
652
659
|
|
653
660
|
(function (sinon) {
|
654
|
-
var commonJSModule = typeof module
|
661
|
+
var commonJSModule = typeof module !== 'undefined' && module.exports;
|
655
662
|
if (!sinon && commonJSModule) {
|
656
663
|
sinon = require("../sinon");
|
657
664
|
}
|
@@ -852,7 +859,7 @@ var sinon = (function (buster) {
|
|
852
859
|
*/
|
853
860
|
|
854
861
|
(function (sinon) {
|
855
|
-
var commonJSModule = typeof module
|
862
|
+
var commonJSModule = typeof module !== 'undefined' && module.exports;
|
856
863
|
var push = Array.prototype.push;
|
857
864
|
var slice = Array.prototype.slice;
|
858
865
|
var callId = 0;
|
@@ -1016,6 +1023,17 @@ var sinon = (function (buster) {
|
|
1016
1023
|
this.callIds[i]);
|
1017
1024
|
},
|
1018
1025
|
|
1026
|
+
getCalls: function () {
|
1027
|
+
var calls = [];
|
1028
|
+
var i;
|
1029
|
+
|
1030
|
+
for (i = 0; i < this.callCount; i++) {
|
1031
|
+
calls.push(this.getCall(i));
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
return calls;
|
1035
|
+
},
|
1036
|
+
|
1019
1037
|
calledBefore: function calledBefore(spyFn) {
|
1020
1038
|
if (!this.called) {
|
1021
1039
|
return false;
|
@@ -1052,6 +1070,7 @@ var sinon = (function (buster) {
|
|
1052
1070
|
var original = this;
|
1053
1071
|
var fake = this._create();
|
1054
1072
|
fake.matchingAguments = args;
|
1073
|
+
fake.parent = this;
|
1055
1074
|
push.call(this.fakes, fake);
|
1056
1075
|
|
1057
1076
|
fake.withArgs = function () {
|
@@ -1092,7 +1111,7 @@ var sinon = (function (buster) {
|
|
1092
1111
|
|
1093
1112
|
if (typeof formatter == "function") {
|
1094
1113
|
return formatter.call(null, spy, args);
|
1095
|
-
} else if (!isNaN(parseInt(specifyer
|
1114
|
+
} else if (!isNaN(parseInt(specifyer, 10))) {
|
1096
1115
|
return sinon.format(args[specifyer - 1]);
|
1097
1116
|
}
|
1098
1117
|
|
@@ -1229,21 +1248,21 @@ var sinon = (function (buster) {
|
|
1229
1248
|
|
1230
1249
|
/**
|
1231
1250
|
* @depend ../sinon.js
|
1232
|
-
* @depend spy.js
|
1233
1251
|
*/
|
1234
1252
|
/*jslint eqeqeq: false, onevar: false*/
|
1235
|
-
/*global module, require, sinon*/
|
1253
|
+
/*global module, require, sinon, process, setImmediate, setTimeout*/
|
1236
1254
|
/**
|
1237
|
-
* Stub
|
1255
|
+
* Stub behavior
|
1238
1256
|
*
|
1239
1257
|
* @author Christian Johansen (christian@cjohansen.no)
|
1258
|
+
* @author Tim Fischbach (mail@timfischbach.de)
|
1240
1259
|
* @license BSD
|
1241
1260
|
*
|
1242
1261
|
* Copyright (c) 2010-2013 Christian Johansen
|
1243
1262
|
*/
|
1244
1263
|
|
1245
1264
|
(function (sinon) {
|
1246
|
-
var commonJSModule = typeof module
|
1265
|
+
var commonJSModule = typeof module !== 'undefined' && module.exports;
|
1247
1266
|
|
1248
1267
|
if (!sinon && commonJSModule) {
|
1249
1268
|
sinon = require("../sinon");
|
@@ -1253,50 +1272,40 @@ var sinon = (function (buster) {
|
|
1253
1272
|
return;
|
1254
1273
|
}
|
1255
1274
|
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
}
|
1260
|
-
|
1261
|
-
var wrapper;
|
1275
|
+
var slice = Array.prototype.slice;
|
1276
|
+
var join = Array.prototype.join;
|
1277
|
+
var proto;
|
1262
1278
|
|
1263
|
-
|
1264
|
-
|
1279
|
+
var nextTick = (function () {
|
1280
|
+
if (typeof process === "object" && typeof process.nextTick === "function") {
|
1281
|
+
return process.nextTick;
|
1282
|
+
} else if (typeof setImmediate === "function") {
|
1283
|
+
return setImmediate;
|
1265
1284
|
} else {
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
if (!object && !property) {
|
1270
|
-
return sinon.stub.create();
|
1285
|
+
return function (callback) {
|
1286
|
+
setTimeout(callback, 0);
|
1287
|
+
};
|
1271
1288
|
}
|
1289
|
+
})();
|
1272
1290
|
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1291
|
+
function throwsException(error, message) {
|
1292
|
+
if (typeof error == "string") {
|
1293
|
+
this.exception = new Error(message || "");
|
1294
|
+
this.exception.name = error;
|
1295
|
+
} else if (!error) {
|
1296
|
+
this.exception = new Error("Error");
|
1297
|
+
} else {
|
1298
|
+
this.exception = error;
|
1281
1299
|
}
|
1282
1300
|
|
1283
|
-
return
|
1284
|
-
}
|
1285
|
-
|
1286
|
-
function getChangingValue(stub, property) {
|
1287
|
-
var index = stub.callCount - 1;
|
1288
|
-
var values = stub[property];
|
1289
|
-
var prop = index in values ? values[index] : values[values.length - 1];
|
1290
|
-
stub[property + "Last"] = prop;
|
1291
|
-
|
1292
|
-
return prop;
|
1301
|
+
return this;
|
1293
1302
|
}
|
1294
1303
|
|
1295
|
-
function getCallback(
|
1296
|
-
var callArgAt =
|
1304
|
+
function getCallback(behavior, args) {
|
1305
|
+
var callArgAt = behavior.callArgAt;
|
1297
1306
|
|
1298
1307
|
if (callArgAt < 0) {
|
1299
|
-
var callArgProp =
|
1308
|
+
var callArgProp = behavior.callArgProp;
|
1300
1309
|
|
1301
1310
|
for (var i = 0, l = args.length; i < l; ++i) {
|
1302
1311
|
if (!callArgProp && typeof args[i] == "function") {
|
@@ -1315,19 +1324,17 @@ var sinon = (function (buster) {
|
|
1315
1324
|
return args[callArgAt];
|
1316
1325
|
}
|
1317
1326
|
|
1318
|
-
|
1319
|
-
|
1320
|
-
function getCallbackError(stub, func, args) {
|
1321
|
-
if (stub.callArgAtsLast < 0) {
|
1327
|
+
function getCallbackError(behavior, func, args) {
|
1328
|
+
if (behavior.callArgAt < 0) {
|
1322
1329
|
var msg;
|
1323
1330
|
|
1324
|
-
if (
|
1325
|
-
msg = sinon.functionName(stub) +
|
1326
|
-
" expected to yield to '" +
|
1327
|
-
"', but no object with such a property was passed."
|
1331
|
+
if (behavior.callArgProp) {
|
1332
|
+
msg = sinon.functionName(behavior.stub) +
|
1333
|
+
" expected to yield to '" + behavior.callArgProp +
|
1334
|
+
"', but no object with such a property was passed.";
|
1328
1335
|
} else {
|
1329
|
-
msg = sinon.functionName(stub) +
|
1330
|
-
|
1336
|
+
msg = sinon.functionName(behavior.stub) +
|
1337
|
+
" expected to yield, but no callback was passed.";
|
1331
1338
|
}
|
1332
1339
|
|
1333
1340
|
if (args.length > 0) {
|
@@ -1337,258 +1344,391 @@ var sinon = (function (buster) {
|
|
1337
1344
|
return msg;
|
1338
1345
|
}
|
1339
1346
|
|
1340
|
-
return "argument at index " +
|
1347
|
+
return "argument at index " + behavior.callArgAt + " is not a function: " + func;
|
1341
1348
|
}
|
1342
1349
|
|
1343
|
-
|
1344
|
-
if (typeof
|
1345
|
-
|
1346
|
-
} else if (typeof setImmediate === "function") {
|
1347
|
-
return setImmediate;
|
1348
|
-
} else {
|
1349
|
-
return function (callback) {
|
1350
|
-
setTimeout(callback, 0);
|
1351
|
-
};
|
1352
|
-
}
|
1353
|
-
})();
|
1354
|
-
|
1355
|
-
function callCallback(stub, args) {
|
1356
|
-
if (stub.callArgAts.length > 0) {
|
1357
|
-
var func = getCallback(stub, args);
|
1350
|
+
function callCallback(behavior, args) {
|
1351
|
+
if (typeof behavior.callArgAt == "number") {
|
1352
|
+
var func = getCallback(behavior, args);
|
1358
1353
|
|
1359
1354
|
if (typeof func != "function") {
|
1360
|
-
throw new TypeError(getCallbackError(
|
1355
|
+
throw new TypeError(getCallbackError(behavior, func, args));
|
1361
1356
|
}
|
1362
1357
|
|
1363
|
-
|
1364
|
-
var callbackContext = getChangingValue(stub, "callbackContexts");
|
1365
|
-
|
1366
|
-
if (stub.callbackAsync) {
|
1358
|
+
if (behavior.callbackAsync) {
|
1367
1359
|
nextTick(function() {
|
1368
|
-
func.apply(callbackContext, callbackArguments);
|
1360
|
+
func.apply(behavior.callbackContext, behavior.callbackArguments);
|
1369
1361
|
});
|
1370
1362
|
} else {
|
1371
|
-
func.apply(callbackContext, callbackArguments);
|
1363
|
+
func.apply(behavior.callbackContext, behavior.callbackArguments);
|
1372
1364
|
}
|
1373
1365
|
}
|
1374
1366
|
}
|
1375
1367
|
|
1376
|
-
|
1368
|
+
proto = {
|
1369
|
+
create: function(stub) {
|
1370
|
+
var behavior = sinon.extend({}, sinon.behavior);
|
1371
|
+
delete behavior.create;
|
1372
|
+
behavior.stub = stub;
|
1377
1373
|
|
1378
|
-
|
1379
|
-
|
1374
|
+
return behavior;
|
1375
|
+
},
|
1380
1376
|
|
1381
|
-
function
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1377
|
+
isPresent: function() {
|
1378
|
+
return (typeof this.callArgAt == 'number' ||
|
1379
|
+
this.exception ||
|
1380
|
+
typeof this.returnArgAt == 'number' ||
|
1381
|
+
this.returnThis ||
|
1382
|
+
this.returnValueDefined);
|
1383
|
+
},
|
1384
|
+
|
1385
|
+
invoke: function(context, args) {
|
1386
|
+
callCallback(this, args);
|
1387
|
+
|
1388
|
+
if (this.exception) {
|
1389
|
+
throw this.exception;
|
1390
|
+
} else if (typeof this.returnArgAt == 'number') {
|
1391
|
+
return args[this.returnArgAt];
|
1392
|
+
} else if (this.returnThis) {
|
1393
|
+
return context;
|
1389
1394
|
}
|
1390
1395
|
|
1396
|
+
return this.returnValue;
|
1397
|
+
},
|
1398
|
+
|
1399
|
+
onCall: function(index) {
|
1400
|
+
return this.stub.onCall(index);
|
1401
|
+
},
|
1402
|
+
|
1403
|
+
onFirstCall: function() {
|
1404
|
+
return this.stub.onFirstCall();
|
1405
|
+
},
|
1406
|
+
|
1407
|
+
onSecondCall: function() {
|
1408
|
+
return this.stub.onSecondCall();
|
1409
|
+
},
|
1410
|
+
|
1411
|
+
onThirdCall: function() {
|
1412
|
+
return this.stub.onThirdCall();
|
1413
|
+
},
|
1414
|
+
|
1415
|
+
withArgs: function(/* arguments */) {
|
1416
|
+
throw new Error('Defining a stub by invoking "stub.onCall(...).withArgs(...)" is not supported. ' +
|
1417
|
+
'Use "stub.withArgs(...).onCall(...)" to define sequential behavior for calls with certain arguments.');
|
1418
|
+
},
|
1419
|
+
|
1420
|
+
callsArg: function callsArg(pos) {
|
1421
|
+
if (typeof pos != "number") {
|
1422
|
+
throw new TypeError("argument index is not number");
|
1423
|
+
}
|
1424
|
+
|
1425
|
+
this.callArgAt = pos;
|
1426
|
+
this.callbackArguments = [];
|
1427
|
+
this.callbackContext = undefined;
|
1428
|
+
this.callArgProp = undefined;
|
1429
|
+
this.callbackAsync = false;
|
1430
|
+
|
1391
1431
|
return this;
|
1392
|
-
}
|
1432
|
+
},
|
1393
1433
|
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1434
|
+
callsArgOn: function callsArgOn(pos, context) {
|
1435
|
+
if (typeof pos != "number") {
|
1436
|
+
throw new TypeError("argument index is not number");
|
1437
|
+
}
|
1438
|
+
if (typeof context != "object") {
|
1439
|
+
throw new TypeError("argument context is not an object");
|
1440
|
+
}
|
1397
1441
|
|
1398
|
-
|
1442
|
+
this.callArgAt = pos;
|
1443
|
+
this.callbackArguments = [];
|
1444
|
+
this.callbackContext = context;
|
1445
|
+
this.callArgProp = undefined;
|
1446
|
+
this.callbackAsync = false;
|
1399
1447
|
|
1400
|
-
|
1401
|
-
|
1402
|
-
} else if (typeof functionStub.returnArgAt == 'number') {
|
1403
|
-
return arguments[functionStub.returnArgAt];
|
1404
|
-
} else if (functionStub.returnThis) {
|
1405
|
-
return this;
|
1406
|
-
}
|
1407
|
-
return functionStub.returnValue;
|
1408
|
-
};
|
1448
|
+
return this;
|
1449
|
+
},
|
1409
1450
|
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1451
|
+
callsArgWith: function callsArgWith(pos) {
|
1452
|
+
if (typeof pos != "number") {
|
1453
|
+
throw new TypeError("argument index is not number");
|
1454
|
+
}
|
1414
1455
|
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1456
|
+
this.callArgAt = pos;
|
1457
|
+
this.callbackArguments = slice.call(arguments, 1);
|
1458
|
+
this.callbackContext = undefined;
|
1459
|
+
this.callArgProp = undefined;
|
1460
|
+
this.callbackAsync = false;
|
1419
1461
|
|
1420
|
-
|
1421
|
-
|
1422
|
-
functionStub.displayName = "stub";
|
1423
|
-
functionStub.toString = sinon.functionToString;
|
1462
|
+
return this;
|
1463
|
+
},
|
1424
1464
|
|
1425
|
-
|
1426
|
-
|
1465
|
+
callsArgOnWith: function callsArgWith(pos, context) {
|
1466
|
+
if (typeof pos != "number") {
|
1467
|
+
throw new TypeError("argument index is not number");
|
1468
|
+
}
|
1469
|
+
if (typeof context != "object") {
|
1470
|
+
throw new TypeError("argument context is not an object");
|
1471
|
+
}
|
1427
1472
|
|
1428
|
-
|
1429
|
-
|
1473
|
+
this.callArgAt = pos;
|
1474
|
+
this.callbackArguments = slice.call(arguments, 2);
|
1475
|
+
this.callbackContext = context;
|
1476
|
+
this.callArgProp = undefined;
|
1477
|
+
this.callbackAsync = false;
|
1430
1478
|
|
1431
|
-
|
1432
|
-
|
1433
|
-
this.callbackContexts = [];
|
1434
|
-
this.callArgProps = [];
|
1479
|
+
return this;
|
1480
|
+
},
|
1435
1481
|
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1482
|
+
yields: function () {
|
1483
|
+
this.callArgAt = -1;
|
1484
|
+
this.callbackArguments = slice.call(arguments, 0);
|
1485
|
+
this.callbackContext = undefined;
|
1486
|
+
this.callArgProp = undefined;
|
1487
|
+
this.callbackAsync = false;
|
1439
1488
|
|
1440
|
-
|
1441
|
-
|
1442
|
-
this.fakes[i].resetBehavior();
|
1443
|
-
}
|
1444
|
-
}
|
1445
|
-
},
|
1489
|
+
return this;
|
1490
|
+
},
|
1446
1491
|
|
1447
|
-
|
1448
|
-
|
1492
|
+
yieldsOn: function (context) {
|
1493
|
+
if (typeof context != "object") {
|
1494
|
+
throw new TypeError("argument context is not an object");
|
1495
|
+
}
|
1449
1496
|
|
1450
|
-
|
1451
|
-
|
1497
|
+
this.callArgAt = -1;
|
1498
|
+
this.callbackArguments = slice.call(arguments, 1);
|
1499
|
+
this.callbackContext = context;
|
1500
|
+
this.callArgProp = undefined;
|
1501
|
+
this.callbackAsync = false;
|
1452
1502
|
|
1453
|
-
|
1454
|
-
|
1455
|
-
throw new TypeError("argument index is not number");
|
1456
|
-
}
|
1503
|
+
return this;
|
1504
|
+
},
|
1457
1505
|
|
1458
|
-
|
1506
|
+
yieldsTo: function (prop) {
|
1507
|
+
this.callArgAt = -1;
|
1508
|
+
this.callbackArguments = slice.call(arguments, 1);
|
1509
|
+
this.callbackContext = undefined;
|
1510
|
+
this.callArgProp = prop;
|
1511
|
+
this.callbackAsync = false;
|
1459
1512
|
|
1460
|
-
|
1461
|
-
|
1513
|
+
return this;
|
1514
|
+
},
|
1462
1515
|
|
1463
|
-
|
1464
|
-
|
1516
|
+
yieldsToOn: function (prop, context) {
|
1517
|
+
if (typeof context != "object") {
|
1518
|
+
throw new TypeError("argument context is not an object");
|
1519
|
+
}
|
1465
1520
|
|
1466
|
-
|
1467
|
-
|
1521
|
+
this.callArgAt = -1;
|
1522
|
+
this.callbackArguments = slice.call(arguments, 2);
|
1523
|
+
this.callbackContext = context;
|
1524
|
+
this.callArgProp = prop;
|
1525
|
+
this.callbackAsync = false;
|
1468
1526
|
|
1469
|
-
|
1470
|
-
|
1527
|
+
return this;
|
1528
|
+
},
|
1471
1529
|
|
1472
|
-
callsArg: function callsArg(pos) {
|
1473
|
-
if (typeof pos != "number") {
|
1474
|
-
throw new TypeError("argument index is not number");
|
1475
|
-
}
|
1476
1530
|
|
1477
|
-
|
1478
|
-
|
1479
|
-
this.callbackContexts.push(undefined);
|
1480
|
-
this.callArgProps.push(undefined);
|
1531
|
+
"throws": throwsException,
|
1532
|
+
throwsException: throwsException,
|
1481
1533
|
|
1482
|
-
|
1483
|
-
|
1534
|
+
returns: function returns(value) {
|
1535
|
+
this.returnValue = value;
|
1536
|
+
this.returnValueDefined = true;
|
1484
1537
|
|
1485
|
-
|
1486
|
-
|
1487
|
-
throw new TypeError("argument index is not number");
|
1488
|
-
}
|
1489
|
-
if (typeof context != "object") {
|
1490
|
-
throw new TypeError("argument context is not an object");
|
1491
|
-
}
|
1538
|
+
return this;
|
1539
|
+
},
|
1492
1540
|
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1541
|
+
returnsArg: function returnsArg(pos) {
|
1542
|
+
if (typeof pos != "number") {
|
1543
|
+
throw new TypeError("argument index is not number");
|
1544
|
+
}
|
1497
1545
|
|
1498
|
-
|
1499
|
-
},
|
1546
|
+
this.returnArgAt = pos;
|
1500
1547
|
|
1501
|
-
|
1502
|
-
|
1503
|
-
throw new TypeError("argument index is not number");
|
1504
|
-
}
|
1548
|
+
return this;
|
1549
|
+
},
|
1505
1550
|
|
1506
|
-
|
1507
|
-
|
1508
|
-
this.callbackContexts.push(undefined);
|
1509
|
-
this.callArgProps.push(undefined);
|
1551
|
+
returnsThis: function returnsThis() {
|
1552
|
+
this.returnThis = true;
|
1510
1553
|
|
1511
|
-
|
1512
|
-
|
1554
|
+
return this;
|
1555
|
+
}
|
1556
|
+
};
|
1513
1557
|
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1558
|
+
// create asynchronous versions of callsArg* and yields* methods
|
1559
|
+
for (var method in proto) {
|
1560
|
+
// need to avoid creating anotherasync versions of the newly added async methods
|
1561
|
+
if (proto.hasOwnProperty(method) &&
|
1562
|
+
method.match(/^(callsArg|yields)/) &&
|
1563
|
+
!method.match(/Async/)) {
|
1564
|
+
proto[method + 'Async'] = (function (syncFnName) {
|
1565
|
+
return function () {
|
1566
|
+
var result = this[syncFnName].apply(this, arguments);
|
1567
|
+
this.callbackAsync = true;
|
1568
|
+
return result;
|
1569
|
+
};
|
1570
|
+
})(method);
|
1571
|
+
}
|
1572
|
+
}
|
1521
1573
|
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1574
|
+
if (commonJSModule) {
|
1575
|
+
module.exports = proto;
|
1576
|
+
} else {
|
1577
|
+
sinon.behavior = proto;
|
1578
|
+
}
|
1579
|
+
}(typeof sinon == "object" && sinon || null));
|
1580
|
+
/**
|
1581
|
+
* @depend ../sinon.js
|
1582
|
+
* @depend spy.js
|
1583
|
+
* @depend behavior.js
|
1584
|
+
*/
|
1585
|
+
/*jslint eqeqeq: false, onevar: false*/
|
1586
|
+
/*global module, require, sinon*/
|
1587
|
+
/**
|
1588
|
+
* Stub functions
|
1589
|
+
*
|
1590
|
+
* @author Christian Johansen (christian@cjohansen.no)
|
1591
|
+
* @license BSD
|
1592
|
+
*
|
1593
|
+
* Copyright (c) 2010-2013 Christian Johansen
|
1594
|
+
*/
|
1526
1595
|
|
1527
|
-
|
1528
|
-
|
1596
|
+
(function (sinon) {
|
1597
|
+
var commonJSModule = typeof module !== 'undefined' && module.exports;
|
1529
1598
|
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
this.callbackContexts.push(undefined);
|
1534
|
-
this.callArgProps.push(undefined);
|
1599
|
+
if (!sinon && commonJSModule) {
|
1600
|
+
sinon = require("../sinon");
|
1601
|
+
}
|
1535
1602
|
|
1536
|
-
|
1537
|
-
|
1603
|
+
if (!sinon) {
|
1604
|
+
return;
|
1605
|
+
}
|
1606
|
+
|
1607
|
+
function stub(object, property, func) {
|
1608
|
+
if (!!func && typeof func != "function") {
|
1609
|
+
throw new TypeError("Custom stub should be function");
|
1610
|
+
}
|
1611
|
+
|
1612
|
+
var wrapper;
|
1613
|
+
|
1614
|
+
if (func) {
|
1615
|
+
wrapper = sinon.spy && sinon.spy.create ? sinon.spy.create(func) : func;
|
1616
|
+
} else {
|
1617
|
+
wrapper = stub.create();
|
1618
|
+
}
|
1619
|
+
|
1620
|
+
if (!object && !property) {
|
1621
|
+
return sinon.stub.create();
|
1622
|
+
}
|
1538
1623
|
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1624
|
+
if (!property && !!object && typeof object == "object") {
|
1625
|
+
for (var prop in object) {
|
1626
|
+
if (typeof object[prop] === "function") {
|
1627
|
+
stub(object, prop);
|
1542
1628
|
}
|
1629
|
+
}
|
1543
1630
|
|
1544
|
-
|
1545
|
-
|
1546
|
-
this.callbackContexts.push(context);
|
1547
|
-
this.callArgProps.push(undefined);
|
1631
|
+
return object;
|
1632
|
+
}
|
1548
1633
|
|
1549
|
-
|
1634
|
+
return sinon.wrapMethod(object, property, wrapper);
|
1635
|
+
}
|
1636
|
+
|
1637
|
+
function getDefaultBehavior(stub) {
|
1638
|
+
return stub.defaultBehavior || getParentBehaviour(stub) || sinon.behavior.create(stub);
|
1639
|
+
}
|
1640
|
+
|
1641
|
+
function getParentBehaviour(stub) {
|
1642
|
+
return (stub.parent && getCurrentBehavior(stub.parent));
|
1643
|
+
}
|
1644
|
+
|
1645
|
+
function getCurrentBehavior(stub) {
|
1646
|
+
var behavior = stub.behaviors[stub.callCount - 1];
|
1647
|
+
return behavior && behavior.isPresent() ? behavior : getDefaultBehavior(stub);
|
1648
|
+
}
|
1649
|
+
|
1650
|
+
var uuid = 0;
|
1651
|
+
|
1652
|
+
sinon.extend(stub, (function () {
|
1653
|
+
var slice = Array.prototype.slice, proto;
|
1654
|
+
|
1655
|
+
proto = {
|
1656
|
+
create: function create() {
|
1657
|
+
var functionStub = function () {
|
1658
|
+
return getCurrentBehavior(functionStub).invoke(this, arguments);
|
1659
|
+
};
|
1660
|
+
|
1661
|
+
functionStub.id = "stub#" + uuid++;
|
1662
|
+
var orig = functionStub;
|
1663
|
+
functionStub = sinon.spy.create(functionStub);
|
1664
|
+
functionStub.func = orig;
|
1665
|
+
|
1666
|
+
sinon.extend(functionStub, stub);
|
1667
|
+
functionStub._create = sinon.stub.create;
|
1668
|
+
functionStub.displayName = "stub";
|
1669
|
+
functionStub.toString = sinon.functionToString;
|
1670
|
+
|
1671
|
+
functionStub.defaultBehavior = null;
|
1672
|
+
functionStub.behaviors = [];
|
1673
|
+
|
1674
|
+
return functionStub;
|
1550
1675
|
},
|
1551
1676
|
|
1552
|
-
|
1553
|
-
|
1554
|
-
this.callbackArguments.push(slice.call(arguments, 1));
|
1555
|
-
this.callbackContexts.push(undefined);
|
1556
|
-
this.callArgProps.push(prop);
|
1677
|
+
resetBehavior: function () {
|
1678
|
+
var i;
|
1557
1679
|
|
1558
|
-
|
1680
|
+
this.defaultBehavior = null;
|
1681
|
+
this.behaviors = [];
|
1682
|
+
|
1683
|
+
delete this.returnValue;
|
1684
|
+
delete this.returnArgAt;
|
1685
|
+
this.returnThis = false;
|
1686
|
+
|
1687
|
+
if (this.fakes) {
|
1688
|
+
for (i = 0; i < this.fakes.length; i++) {
|
1689
|
+
this.fakes[i].resetBehavior();
|
1690
|
+
}
|
1691
|
+
}
|
1559
1692
|
},
|
1560
1693
|
|
1561
|
-
|
1562
|
-
if (
|
1563
|
-
|
1694
|
+
onCall: function(index) {
|
1695
|
+
if (!this.behaviors[index]) {
|
1696
|
+
this.behaviors[index] = sinon.behavior.create(this);
|
1564
1697
|
}
|
1565
1698
|
|
1566
|
-
this.
|
1567
|
-
|
1568
|
-
this.callbackContexts.push(context);
|
1569
|
-
this.callArgProps.push(prop);
|
1699
|
+
return this.behaviors[index];
|
1700
|
+
},
|
1570
1701
|
|
1571
|
-
|
1702
|
+
onFirstCall: function() {
|
1703
|
+
return this.onCall(0);
|
1704
|
+
},
|
1705
|
+
|
1706
|
+
onSecondCall: function() {
|
1707
|
+
return this.onCall(1);
|
1708
|
+
},
|
1709
|
+
|
1710
|
+
onThirdCall: function() {
|
1711
|
+
return this.onCall(2);
|
1572
1712
|
}
|
1573
1713
|
};
|
1574
1714
|
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
method
|
1580
|
-
|
1581
|
-
proto[method
|
1582
|
-
return function
|
1583
|
-
this.
|
1584
|
-
|
1715
|
+
for (var method in sinon.behavior) {
|
1716
|
+
if (sinon.behavior.hasOwnProperty(method) &&
|
1717
|
+
!proto.hasOwnProperty(method) &&
|
1718
|
+
method != 'create' &&
|
1719
|
+
method != 'withArgs' &&
|
1720
|
+
method != 'invoke') {
|
1721
|
+
proto[method] = (function(behaviorMethod) {
|
1722
|
+
return function() {
|
1723
|
+
this.defaultBehavior = this.defaultBehavior || sinon.behavior.create(this);
|
1724
|
+
this.defaultBehavior[behaviorMethod].apply(this.defaultBehavior, arguments);
|
1725
|
+
return this;
|
1585
1726
|
};
|
1586
|
-
}
|
1727
|
+
}(method));
|
1587
1728
|
}
|
1588
1729
|
}
|
1589
1730
|
|
1590
1731
|
return proto;
|
1591
|
-
|
1592
1732
|
}()));
|
1593
1733
|
|
1594
1734
|
if (commonJSModule) {
|
@@ -1614,8 +1754,9 @@ var sinon = (function (buster) {
|
|
1614
1754
|
*/
|
1615
1755
|
|
1616
1756
|
(function (sinon) {
|
1617
|
-
var commonJSModule = typeof module
|
1757
|
+
var commonJSModule = typeof module !== 'undefined' && module.exports;
|
1618
1758
|
var push = [].push;
|
1759
|
+
var match;
|
1619
1760
|
|
1620
1761
|
if (!sinon && commonJSModule) {
|
1621
1762
|
sinon = require("../sinon");
|
@@ -1625,6 +1766,12 @@ var sinon = (function (buster) {
|
|
1625
1766
|
return;
|
1626
1767
|
}
|
1627
1768
|
|
1769
|
+
match = sinon.match;
|
1770
|
+
|
1771
|
+
if (!match && commonJSModule) {
|
1772
|
+
match = require("./match");
|
1773
|
+
}
|
1774
|
+
|
1628
1775
|
function mock(object) {
|
1629
1776
|
if (!object) {
|
1630
1777
|
return sinon.expectation.create("Anonymous mock");
|
@@ -1805,6 +1952,14 @@ var sinon = (function (buster) {
|
|
1805
1952
|
return expectation.callCount == expectation.maxCalls;
|
1806
1953
|
}
|
1807
1954
|
|
1955
|
+
function verifyMatcher(possibleMatcher, arg){
|
1956
|
+
if (match && match.isMatcher(possibleMatcher)) {
|
1957
|
+
return possibleMatcher.test(arg);
|
1958
|
+
} else {
|
1959
|
+
return true;
|
1960
|
+
}
|
1961
|
+
}
|
1962
|
+
|
1808
1963
|
return {
|
1809
1964
|
minCalls: 1,
|
1810
1965
|
maxCalls: 1,
|
@@ -1914,6 +2069,12 @@ var sinon = (function (buster) {
|
|
1914
2069
|
}
|
1915
2070
|
|
1916
2071
|
for (var i = 0, l = this.expectedArguments.length; i < l; i += 1) {
|
2072
|
+
|
2073
|
+
if (!verifyMatcher(this.expectedArguments[i],args[i])) {
|
2074
|
+
sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) +
|
2075
|
+
", didn't match " + this.expectedArguments.toString());
|
2076
|
+
}
|
2077
|
+
|
1917
2078
|
if (!sinon.deepEqual(this.expectedArguments[i], args[i])) {
|
1918
2079
|
sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) +
|
1919
2080
|
", expected " + sinon.format(this.expectedArguments));
|
@@ -1946,6 +2107,10 @@ var sinon = (function (buster) {
|
|
1946
2107
|
}
|
1947
2108
|
|
1948
2109
|
for (var i = 0, l = this.expectedArguments.length; i < l; i += 1) {
|
2110
|
+
if (!verifyMatcher(this.expectedArguments[i],args[i])) {
|
2111
|
+
return false;
|
2112
|
+
}
|
2113
|
+
|
1949
2114
|
if (!sinon.deepEqual(this.expectedArguments[i], args[i])) {
|
1950
2115
|
return false;
|
1951
2116
|
}
|
@@ -2039,7 +2204,7 @@ var sinon = (function (buster) {
|
|
2039
2204
|
*/
|
2040
2205
|
|
2041
2206
|
(function (sinon) {
|
2042
|
-
var commonJSModule = typeof module
|
2207
|
+
var commonJSModule = typeof module !== 'undefined' && module.exports;
|
2043
2208
|
var push = [].push;
|
2044
2209
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
2045
2210
|
|
@@ -2338,7 +2503,7 @@ if (typeof sinon == "undefined") {
|
|
2338
2503
|
},
|
2339
2504
|
|
2340
2505
|
firstTimerInRange: function (from, to) {
|
2341
|
-
var timer, smallest, originalTimer;
|
2506
|
+
var timer, smallest = null, originalTimer;
|
2342
2507
|
|
2343
2508
|
for (var id in this.timeouts) {
|
2344
2509
|
if (this.timeouts.hasOwnProperty(id)) {
|
@@ -2346,7 +2511,7 @@ if (typeof sinon == "undefined") {
|
|
2346
2511
|
continue;
|
2347
2512
|
}
|
2348
2513
|
|
2349
|
-
if (
|
2514
|
+
if (smallest === null || this.timeouts[id].callAt < smallest) {
|
2350
2515
|
originalTimer = this.timeouts[id];
|
2351
2516
|
smallest = this.timeouts[id].callAt;
|
2352
2517
|
|
@@ -2522,7 +2687,7 @@ sinon.timers = {
|
|
2522
2687
|
Date: Date
|
2523
2688
|
};
|
2524
2689
|
|
2525
|
-
if (typeof module
|
2690
|
+
if (typeof module !== 'undefined' && module.exports) {
|
2526
2691
|
module.exports = sinon;
|
2527
2692
|
}
|
2528
2693
|
|
@@ -2616,13 +2781,14 @@ if (typeof sinon == "undefined") {
|
|
2616
2781
|
* Copyright (c) 2010-2013 Christian Johansen
|
2617
2782
|
*/
|
2618
2783
|
|
2619
|
-
if (typeof sinon == "undefined") {
|
2620
|
-
this.sinon = {};
|
2621
|
-
}
|
2622
|
-
sinon.xhr = { XMLHttpRequest: this.XMLHttpRequest };
|
2623
|
-
|
2624
2784
|
// wrapper for global
|
2625
2785
|
(function(global) {
|
2786
|
+
|
2787
|
+
if (typeof sinon === "undefined") {
|
2788
|
+
global.sinon = {};
|
2789
|
+
}
|
2790
|
+
sinon.xhr = { XMLHttpRequest: global.XMLHttpRequest };
|
2791
|
+
|
2626
2792
|
var xhr = sinon.xhr;
|
2627
2793
|
xhr.GlobalXMLHttpRequest = global.XMLHttpRequest;
|
2628
2794
|
xhr.GlobalActiveXObject = global.ActiveXObject;
|
@@ -2660,6 +2826,7 @@ sinon.xhr = { XMLHttpRequest: this.XMLHttpRequest };
|
|
2660
2826
|
this.requestBody = null;
|
2661
2827
|
this.status = 0;
|
2662
2828
|
this.statusText = "";
|
2829
|
+
this.upload = new UploadProgress();
|
2663
2830
|
|
2664
2831
|
var xhr = this;
|
2665
2832
|
var events = ["loadstart", "load", "abort", "loadend"];
|
@@ -2683,6 +2850,31 @@ sinon.xhr = { XMLHttpRequest: this.XMLHttpRequest };
|
|
2683
2850
|
}
|
2684
2851
|
}
|
2685
2852
|
|
2853
|
+
// An upload object is created for each
|
2854
|
+
// FakeXMLHttpRequest and allows upload
|
2855
|
+
// events to be simulated using uploadProgress
|
2856
|
+
// and uploadError.
|
2857
|
+
function UploadProgress() {
|
2858
|
+
this.eventListeners = {
|
2859
|
+
"progress": [],
|
2860
|
+
"load": [],
|
2861
|
+
"abort": [],
|
2862
|
+
"error": []
|
2863
|
+
}
|
2864
|
+
};
|
2865
|
+
|
2866
|
+
UploadProgress.prototype.addEventListener = function(listenerName, callback) {
|
2867
|
+
this.eventListeners[listenerName].push(callback);
|
2868
|
+
};
|
2869
|
+
|
2870
|
+
UploadProgress.prototype.dispatchEvent = function(event) {
|
2871
|
+
var listeners = this.eventListeners[event.type] || [];
|
2872
|
+
|
2873
|
+
for (var i = 0, listener; (listener = listeners[i]) != null; i++) {
|
2874
|
+
listener(event);
|
2875
|
+
}
|
2876
|
+
};
|
2877
|
+
|
2686
2878
|
function verifyState(xhr) {
|
2687
2879
|
if (xhr.readyState !== FakeXMLHttpRequest.OPENED) {
|
2688
2880
|
throw new Error("INVALID_STATE_ERR");
|
@@ -2836,6 +3028,8 @@ sinon.xhr = { XMLHttpRequest: this.XMLHttpRequest };
|
|
2836
3028
|
case FakeXMLHttpRequest.DONE:
|
2837
3029
|
this.dispatchEvent(new sinon.Event("load", false, false, this));
|
2838
3030
|
this.dispatchEvent(new sinon.Event("loadend", false, false, this));
|
3031
|
+
this.upload.dispatchEvent(new sinon.Event("load", false, false, this));
|
3032
|
+
this.upload.dispatchEvent(new ProgressEvent("progress", {loaded: 100, total: 100}));
|
2839
3033
|
break;
|
2840
3034
|
}
|
2841
3035
|
},
|
@@ -2911,6 +3105,9 @@ sinon.xhr = { XMLHttpRequest: this.XMLHttpRequest };
|
|
2911
3105
|
this.readyState = sinon.FakeXMLHttpRequest.UNSENT;
|
2912
3106
|
|
2913
3107
|
this.dispatchEvent(new sinon.Event("abort", false, false, this));
|
3108
|
+
|
3109
|
+
this.upload.dispatchEvent(new sinon.Event("abort", false, false, this));
|
3110
|
+
|
2914
3111
|
if (typeof this.onerror === "function") {
|
2915
3112
|
this.onerror();
|
2916
3113
|
}
|
@@ -2994,10 +3191,14 @@ sinon.xhr = { XMLHttpRequest: this.XMLHttpRequest };
|
|
2994
3191
|
this.status = typeof status == "number" ? status : 200;
|
2995
3192
|
this.statusText = FakeXMLHttpRequest.statusCodes[this.status];
|
2996
3193
|
this.setResponseBody(body || "");
|
2997
|
-
|
2998
|
-
|
2999
|
-
|
3194
|
+
},
|
3195
|
+
|
3196
|
+
uploadProgress: function uploadProgress(progressEventRaw) {
|
3197
|
+
this.upload.dispatchEvent(new ProgressEvent("progress", progressEventRaw));
|
3198
|
+
},
|
3000
3199
|
|
3200
|
+
uploadError: function uploadError(error) {
|
3201
|
+
this.upload.dispatchEvent(new CustomEvent("error", {"detail": error}));
|
3001
3202
|
}
|
3002
3203
|
});
|
3003
3204
|
|
@@ -3104,9 +3305,10 @@ sinon.xhr = { XMLHttpRequest: this.XMLHttpRequest };
|
|
3104
3305
|
};
|
3105
3306
|
|
3106
3307
|
sinon.FakeXMLHttpRequest = FakeXMLHttpRequest;
|
3107
|
-
})(this);
|
3108
3308
|
|
3109
|
-
|
3309
|
+
})(typeof global === "object" ? global : this);
|
3310
|
+
|
3311
|
+
if (typeof module !== 'undefined' && module.exports) {
|
3110
3312
|
module.exports = sinon;
|
3111
3313
|
}
|
3112
3314
|
|
@@ -3216,16 +3418,16 @@ sinon.fakeServer = (function () {
|
|
3216
3418
|
|
3217
3419
|
xhrObj.onSend = function () {
|
3218
3420
|
server.handleRequest(this);
|
3219
|
-
};
|
3220
3421
|
|
3221
|
-
|
3222
|
-
|
3223
|
-
|
3224
|
-
|
3225
|
-
|
3422
|
+
if (server.autoRespond && !server.responding) {
|
3423
|
+
setTimeout(function () {
|
3424
|
+
server.responding = false;
|
3425
|
+
server.respond();
|
3426
|
+
}, server.autoRespondAfter || 10);
|
3226
3427
|
|
3227
|
-
|
3228
|
-
|
3428
|
+
server.responding = true;
|
3429
|
+
}
|
3430
|
+
};
|
3229
3431
|
},
|
3230
3432
|
|
3231
3433
|
getHTTPMethod: function getHTTPMethod(request) {
|
@@ -3318,7 +3520,7 @@ sinon.fakeServer = (function () {
|
|
3318
3520
|
};
|
3319
3521
|
}());
|
3320
3522
|
|
3321
|
-
if (typeof module
|
3523
|
+
if (typeof module !== 'undefined' && module.exports) {
|
3322
3524
|
module.exports = sinon;
|
3323
3525
|
}
|
3324
3526
|
|
@@ -3423,7 +3625,7 @@ if (typeof module == "object" && typeof require == "function") {
|
|
3423
3625
|
* Copyright (c) 2010-2013 Christian Johansen
|
3424
3626
|
*/
|
3425
3627
|
|
3426
|
-
if (typeof module
|
3628
|
+
if (typeof module !== 'undefined' && module.exports) {
|
3427
3629
|
var sinon = require("../sinon");
|
3428
3630
|
sinon.extend(sinon, require("./util/fake_timers"));
|
3429
3631
|
}
|
@@ -3525,7 +3727,7 @@ if (typeof module == "object" && typeof require == "function") {
|
|
3525
3727
|
|
3526
3728
|
sinon.sandbox.useFakeXMLHttpRequest = sinon.sandbox.useFakeServer;
|
3527
3729
|
|
3528
|
-
if (typeof module
|
3730
|
+
if (typeof module !== 'undefined' && module.exports) {
|
3529
3731
|
module.exports = sinon.sandbox;
|
3530
3732
|
}
|
3531
3733
|
}());
|
@@ -3548,7 +3750,7 @@ if (typeof module == "object" && typeof require == "function") {
|
|
3548
3750
|
*/
|
3549
3751
|
|
3550
3752
|
(function (sinon) {
|
3551
|
-
var commonJSModule = typeof module
|
3753
|
+
var commonJSModule = typeof module !== 'undefined' && module.exports;
|
3552
3754
|
|
3553
3755
|
if (!sinon && commonJSModule) {
|
3554
3756
|
sinon = require("../sinon");
|
@@ -3621,7 +3823,7 @@ if (typeof module == "object" && typeof require == "function") {
|
|
3621
3823
|
*/
|
3622
3824
|
|
3623
3825
|
(function (sinon) {
|
3624
|
-
var commonJSModule = typeof module
|
3826
|
+
var commonJSModule = typeof module !== 'undefined' && module.exports;
|
3625
3827
|
|
3626
3828
|
if (!sinon && commonJSModule) {
|
3627
3829
|
sinon = require("../sinon");
|
@@ -3718,7 +3920,7 @@ if (typeof module == "object" && typeof require == "function") {
|
|
3718
3920
|
*/
|
3719
3921
|
|
3720
3922
|
(function (sinon, global) {
|
3721
|
-
var commonJSModule = typeof module
|
3923
|
+
var commonJSModule = typeof module !== "undefined" && module.exports;
|
3722
3924
|
var slice = Array.prototype.slice;
|
3723
3925
|
var assert;
|
3724
3926
|
|