Update checked-in dependencies
This commit is contained in:
parent
3ba511a8f1
commit
1c4c64199f
175 changed files with 13227 additions and 15136 deletions
1
node_modules/nise/README.md
generated
vendored
1
node_modules/nise/README.md
generated
vendored
|
|
@ -44,7 +44,6 @@ Support us with a monthly donation and help us continue our activities. [[Become
|
|||
<a href="https://opencollective.com/sinon/backer/28/website" target="_blank"><img src="https://opencollective.com/sinon/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/29/website" target="_blank"><img src="https://opencollective.com/sinon/backer/29/avatar.svg"></a>
|
||||
|
||||
|
||||
## Sponsors
|
||||
|
||||
Become a sponsor and get your logo on our README on GitHub with a link to your site. [[Become a sponsor](https://opencollective.com/sinon#sponsor)]
|
||||
|
|
|
|||
4
node_modules/nise/lib/configure-logger/index.js
generated
vendored
4
node_modules/nise/lib/configure-logger/index.js
generated
vendored
|
|
@ -24,7 +24,7 @@ function configureLogger(config) {
|
|||
}
|
||||
|
||||
return function logError(label, e) {
|
||||
var msg = label + " threw exception: ";
|
||||
var msg = `${label} threw exception: `;
|
||||
var err = {
|
||||
name: e.name || label,
|
||||
message: e.message || e.toString(),
|
||||
|
|
@ -36,7 +36,7 @@ function configureLogger(config) {
|
|||
throw err;
|
||||
}
|
||||
|
||||
config.logger(msg + "[" + err.name + "] " + err.message);
|
||||
config.logger(`${msg}[${err.name}] ${err.message}`);
|
||||
|
||||
if (err.stack) {
|
||||
config.logger(err.stack);
|
||||
|
|
|
|||
34
node_modules/nise/lib/fake-server/index.js
generated
vendored
34
node_modules/nise/lib/fake-server/index.js
generated
vendored
|
|
@ -18,13 +18,11 @@ function responseArray(handler) {
|
|||
if (typeof response[2] !== "string") {
|
||||
if (!supportsArrayBuffer) {
|
||||
throw new TypeError(
|
||||
"Fake server response body should be a string, but was " +
|
||||
typeof response[2]
|
||||
`Fake server response body should be a string, but was ${typeof response[2]}`
|
||||
);
|
||||
} else if (!(response[2] instanceof ArrayBuffer)) {
|
||||
throw new TypeError(
|
||||
"Fake server response body should be a string or ArrayBuffer, but was " +
|
||||
typeof response[2]
|
||||
`Fake server response body should be a string or ArrayBuffer, but was ${typeof response[2]}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -33,7 +31,15 @@ function responseArray(handler) {
|
|||
}
|
||||
|
||||
function getDefaultWindowLocation() {
|
||||
return { host: "localhost", protocol: "http" };
|
||||
var winloc = {
|
||||
hostname: "localhost",
|
||||
port: process.env.PORT || 80,
|
||||
protocol: "http:"
|
||||
};
|
||||
winloc.host =
|
||||
winloc.hostname +
|
||||
(String(winloc.port) === "80" ? "" : `:${winloc.port}`);
|
||||
return winloc;
|
||||
}
|
||||
|
||||
function getWindowLocation() {
|
||||
|
|
@ -65,7 +71,8 @@ function matchOne(response, reqMethod, reqUrl) {
|
|||
var matchUrl =
|
||||
!url ||
|
||||
url === reqUrl ||
|
||||
(typeof url.test === "function" && url.test(reqUrl));
|
||||
(typeof url.test === "function" && url.test(reqUrl)) ||
|
||||
(typeof url === "function" && url(reqUrl) === true);
|
||||
|
||||
return matchMethod && matchUrl;
|
||||
}
|
||||
|
|
@ -73,12 +80,12 @@ function matchOne(response, reqMethod, reqUrl) {
|
|||
function match(response, request) {
|
||||
var wloc = getWindowLocation();
|
||||
|
||||
var rCurrLoc = new RegExp("^" + wloc.protocol + "//" + wloc.host);
|
||||
var rCurrLoc = new RegExp(`^${wloc.protocol}//${wloc.host}/`);
|
||||
|
||||
var requestUrl = request.url;
|
||||
|
||||
if (!/^https?:\/\//.test(requestUrl) || rCurrLoc.test(requestUrl)) {
|
||||
requestUrl = requestUrl.replace(rCurrLoc, "");
|
||||
requestUrl = requestUrl.replace(rCurrLoc, "/");
|
||||
}
|
||||
|
||||
if (matchOne(response, this.getHTTPMethod(request), requestUrl)) {
|
||||
|
|
@ -136,7 +143,7 @@ var fakeServer = {
|
|||
|
||||
configure: function(config) {
|
||||
var self = this;
|
||||
var whitelist = {
|
||||
var allowlist = {
|
||||
autoRespond: true,
|
||||
autoRespondAfter: true,
|
||||
respondImmediately: true,
|
||||
|
|
@ -149,7 +156,7 @@ var fakeServer = {
|
|||
config = config || {};
|
||||
|
||||
Object.keys(config).forEach(function(setting) {
|
||||
if (setting in whitelist) {
|
||||
if (setting in allowlist) {
|
||||
self[setting] = config[setting];
|
||||
}
|
||||
});
|
||||
|
|
@ -228,6 +235,13 @@ var fakeServer = {
|
|||
method = null;
|
||||
}
|
||||
|
||||
// Escape port number to prevent "named" parameters in 'path-to-regexp' module
|
||||
if (typeof url === "string" && url !== "" && /:[0-9]+\//.test(url)) {
|
||||
var m = url.match(/^(https?:\/\/.*?):([0-9]+\/.*)$/);
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
url = `${m[1]}\\:${m[2]}`;
|
||||
}
|
||||
|
||||
push.call(this.responses, {
|
||||
method: method,
|
||||
url:
|
||||
|
|
|
|||
4
node_modules/nise/lib/fake-server/log.js
generated
vendored
4
node_modules/nise/lib/fake-server/log.js
generated
vendored
|
|
@ -4,8 +4,8 @@ var inspect = require("util").inspect;
|
|||
function log(response, request) {
|
||||
var str;
|
||||
|
||||
str = "Request:\n" + inspect(request) + "\n\n";
|
||||
str += "Response:\n" + inspect(response) + "\n\n";
|
||||
str = `Request:\n${inspect(request)}\n\n`;
|
||||
str += `Response:\n${inspect(response)}\n\n`;
|
||||
|
||||
/* istanbul ignore else: when this.logger is not a function, it can't be called */
|
||||
if (typeof this.logger === "function") {
|
||||
|
|
|
|||
41
node_modules/nise/lib/fake-xhr/index.js
generated
vendored
41
node_modules/nise/lib/fake-xhr/index.js
generated
vendored
|
|
@ -71,7 +71,7 @@ function EventTargetHandler() {
|
|||
|
||||
function addEventListener(eventName) {
|
||||
self.addEventListener(eventName, function(event) {
|
||||
var listener = self["on" + eventName];
|
||||
var listener = self[`on${eventName}`];
|
||||
|
||||
if (listener && typeof listener === "function") {
|
||||
listener.call(this, event);
|
||||
|
|
@ -109,17 +109,13 @@ function verifyResponseBodyType(body, responseType) {
|
|||
if (responseType === "arraybuffer") {
|
||||
if (!isString && !(body instanceof ArrayBuffer)) {
|
||||
error = new Error(
|
||||
"Attempted to respond to fake XMLHttpRequest with " +
|
||||
body +
|
||||
", which is not a string or ArrayBuffer."
|
||||
`Attempted to respond to fake XMLHttpRequest with ${body}, which is not a string or ArrayBuffer.`
|
||||
);
|
||||
error.name = "InvalidBodyException";
|
||||
}
|
||||
} else if (!isString) {
|
||||
error = new Error(
|
||||
"Attempted to respond to fake XMLHttpRequest with " +
|
||||
body +
|
||||
", which is not a string."
|
||||
`Attempted to respond to fake XMLHttpRequest with ${body}, which is not a string.`
|
||||
);
|
||||
error.name = "InvalidBodyException";
|
||||
}
|
||||
|
|
@ -325,7 +321,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
|
||||
function verifyRequestOpened(xhr) {
|
||||
if (xhr.readyState !== FakeXMLHttpRequest.OPENED) {
|
||||
throw new Error("INVALID_STATE_ERR - " + xhr.readyState);
|
||||
throw new Error(`INVALID_STATE_ERR - ${xhr.readyState}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -368,7 +364,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
throw new Error("Invalid responseType " + responseType);
|
||||
throw new Error(`Invalid responseType ${responseType}`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -517,8 +513,6 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
false,
|
||||
this
|
||||
);
|
||||
var event, progress;
|
||||
|
||||
if (typeof this.onreadystatechange === "function") {
|
||||
try {
|
||||
this.onreadystatechange(readyStateChangeEvent);
|
||||
|
|
@ -527,7 +521,11 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
}
|
||||
}
|
||||
|
||||
if (this.readyState === FakeXMLHttpRequest.DONE) {
|
||||
if (this.readyState !== FakeXMLHttpRequest.DONE) {
|
||||
this.dispatchEvent(readyStateChangeEvent);
|
||||
} else {
|
||||
var event, progress;
|
||||
|
||||
if (this.timedOut || this.aborted || this.status === 0) {
|
||||
progress = { loaded: 0, total: 0 };
|
||||
event =
|
||||
|
|
@ -557,20 +555,18 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
this.dispatchEvent(
|
||||
new sinonEvent.ProgressEvent(event, progress, this)
|
||||
);
|
||||
this.dispatchEvent(readyStateChangeEvent);
|
||||
this.dispatchEvent(
|
||||
new sinonEvent.ProgressEvent("loadend", progress, this)
|
||||
);
|
||||
}
|
||||
|
||||
this.dispatchEvent(readyStateChangeEvent);
|
||||
},
|
||||
|
||||
// Ref https://xhr.spec.whatwg.org/#the-setrequestheader()-method
|
||||
setRequestHeader: function setRequestHeader(header, value) {
|
||||
if (typeof value !== "string") {
|
||||
throw new TypeError(
|
||||
"By RFC7230, section 3.2.4, header values should be strings. Got " +
|
||||
typeof value
|
||||
`By RFC7230, section 3.2.4, header values should be strings. Got ${typeof value}`
|
||||
);
|
||||
}
|
||||
verifyState(this);
|
||||
|
|
@ -587,7 +583,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
) {
|
||||
throw new Error(
|
||||
// eslint-disable-next-line quotes
|
||||
'Refused to set unsafe header "' + header + '"'
|
||||
`Refused to set unsafe header "${header}"`
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -596,7 +592,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
|
||||
var existingHeader = getHeader(this.requestHeaders, header);
|
||||
if (existingHeader) {
|
||||
this.requestHeaders[existingHeader] += ", " + value;
|
||||
this.requestHeaders[existingHeader] += `, ${value}`;
|
||||
} else {
|
||||
this.requestHeaders[header] = value;
|
||||
}
|
||||
|
|
@ -638,8 +634,9 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
);
|
||||
if (this.requestHeaders[contentType]) {
|
||||
var value = this.requestHeaders[contentType].split(";");
|
||||
this.requestHeaders[contentType] =
|
||||
value[0] + ";charset=utf-8";
|
||||
this.requestHeaders[
|
||||
contentType
|
||||
] = `${value[0]};charset=utf-8`;
|
||||
} else if (supportsFormData && !(data instanceof FormData)) {
|
||||
this.requestHeaders["Content-Type"] =
|
||||
"text/plain;charset=utf-8";
|
||||
|
|
@ -744,7 +741,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
.reduce(function(prev, header) {
|
||||
var value = responseHeaders[header];
|
||||
|
||||
return prev + (header + ": " + value + "\r\n");
|
||||
return `${prev}${header}: ${value}\r\n`;
|
||||
}, "");
|
||||
|
||||
return headers;
|
||||
|
|
@ -801,6 +798,8 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
},
|
||||
|
||||
respond: function respond(status, headers, body) {
|
||||
this.responseURL = this.url;
|
||||
|
||||
this.setStatus(status);
|
||||
this.setResponseHeaders(headers || {});
|
||||
this.setResponseBody(body || "");
|
||||
|
|
|
|||
251
node_modules/nise/nise.js
generated
vendored
251
node_modules/nise/nise.js
generated
vendored
|
|
@ -25,7 +25,7 @@ function configureLogger(config) {
|
|||
}
|
||||
|
||||
return function logError(label, e) {
|
||||
var msg = label + " threw exception: ";
|
||||
var msg = `${label} threw exception: `;
|
||||
var err = {
|
||||
name: e.name || label,
|
||||
message: e.message || e.toString(),
|
||||
|
|
@ -37,7 +37,7 @@ function configureLogger(config) {
|
|||
throw err;
|
||||
}
|
||||
|
||||
config.logger(msg + "[" + err.name + "] " + err.message);
|
||||
config.logger(`${msg}[${err.name}] ${err.message}`);
|
||||
|
||||
if (err.stack) {
|
||||
config.logger(err.stack);
|
||||
|
|
@ -349,13 +349,11 @@ function responseArray(handler) {
|
|||
if (typeof response[2] !== "string") {
|
||||
if (!supportsArrayBuffer) {
|
||||
throw new TypeError(
|
||||
"Fake server response body should be a string, but was " +
|
||||
typeof response[2]
|
||||
`Fake server response body should be a string, but was ${typeof response[2]}`
|
||||
);
|
||||
} else if (!(response[2] instanceof ArrayBuffer)) {
|
||||
throw new TypeError(
|
||||
"Fake server response body should be a string or ArrayBuffer, but was " +
|
||||
typeof response[2]
|
||||
`Fake server response body should be a string or ArrayBuffer, but was ${typeof response[2]}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -364,7 +362,15 @@ function responseArray(handler) {
|
|||
}
|
||||
|
||||
function getDefaultWindowLocation() {
|
||||
return { host: "localhost", protocol: "http" };
|
||||
var winloc = {
|
||||
hostname: "localhost",
|
||||
port: process.env.PORT || 80,
|
||||
protocol: "http:"
|
||||
};
|
||||
winloc.host =
|
||||
winloc.hostname +
|
||||
(String(winloc.port) === "80" ? "" : `:${winloc.port}`);
|
||||
return winloc;
|
||||
}
|
||||
|
||||
function getWindowLocation() {
|
||||
|
|
@ -396,7 +402,8 @@ function matchOne(response, reqMethod, reqUrl) {
|
|||
var matchUrl =
|
||||
!url ||
|
||||
url === reqUrl ||
|
||||
(typeof url.test === "function" && url.test(reqUrl));
|
||||
(typeof url.test === "function" && url.test(reqUrl)) ||
|
||||
(typeof url === "function" && url(reqUrl) === true);
|
||||
|
||||
return matchMethod && matchUrl;
|
||||
}
|
||||
|
|
@ -404,12 +411,12 @@ function matchOne(response, reqMethod, reqUrl) {
|
|||
function match(response, request) {
|
||||
var wloc = getWindowLocation();
|
||||
|
||||
var rCurrLoc = new RegExp("^" + wloc.protocol + "//" + wloc.host);
|
||||
var rCurrLoc = new RegExp(`^${wloc.protocol}//${wloc.host}/`);
|
||||
|
||||
var requestUrl = request.url;
|
||||
|
||||
if (!/^https?:\/\//.test(requestUrl) || rCurrLoc.test(requestUrl)) {
|
||||
requestUrl = requestUrl.replace(rCurrLoc, "");
|
||||
requestUrl = requestUrl.replace(rCurrLoc, "/");
|
||||
}
|
||||
|
||||
if (matchOne(response, this.getHTTPMethod(request), requestUrl)) {
|
||||
|
|
@ -467,7 +474,7 @@ var fakeServer = {
|
|||
|
||||
configure: function(config) {
|
||||
var self = this;
|
||||
var whitelist = {
|
||||
var allowlist = {
|
||||
autoRespond: true,
|
||||
autoRespondAfter: true,
|
||||
respondImmediately: true,
|
||||
|
|
@ -480,7 +487,7 @@ var fakeServer = {
|
|||
config = config || {};
|
||||
|
||||
Object.keys(config).forEach(function(setting) {
|
||||
if (setting in whitelist) {
|
||||
if (setting in allowlist) {
|
||||
self[setting] = config[setting];
|
||||
}
|
||||
});
|
||||
|
|
@ -559,6 +566,13 @@ var fakeServer = {
|
|||
method = null;
|
||||
}
|
||||
|
||||
// Escape port number to prevent "named" parameters in 'path-to-regexp' module
|
||||
if (typeof url === "string" && url !== "" && /:[0-9]+\//.test(url)) {
|
||||
var m = url.match(/^(https?:\/\/.*?):([0-9]+\/.*)$/);
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
url = `${m[1]}\\:${m[2]}`;
|
||||
}
|
||||
|
||||
push.call(this.responses, {
|
||||
method: method,
|
||||
url:
|
||||
|
|
@ -656,8 +670,8 @@ var inspect = require("util").inspect;
|
|||
function log(response, request) {
|
||||
var str;
|
||||
|
||||
str = "Request:\n" + inspect(request) + "\n\n";
|
||||
str += "Response:\n" + inspect(response) + "\n\n";
|
||||
str = `Request:\n${inspect(request)}\n\n`;
|
||||
str += `Response:\n${inspect(response)}\n\n`;
|
||||
|
||||
/* istanbul ignore else: when this.logger is not a function, it can't be called */
|
||||
if (typeof this.logger === "function") {
|
||||
|
|
@ -752,7 +766,7 @@ function EventTargetHandler() {
|
|||
|
||||
function addEventListener(eventName) {
|
||||
self.addEventListener(eventName, function(event) {
|
||||
var listener = self["on" + eventName];
|
||||
var listener = self[`on${eventName}`];
|
||||
|
||||
if (listener && typeof listener === "function") {
|
||||
listener.call(this, event);
|
||||
|
|
@ -790,17 +804,13 @@ function verifyResponseBodyType(body, responseType) {
|
|||
if (responseType === "arraybuffer") {
|
||||
if (!isString && !(body instanceof ArrayBuffer)) {
|
||||
error = new Error(
|
||||
"Attempted to respond to fake XMLHttpRequest with " +
|
||||
body +
|
||||
", which is not a string or ArrayBuffer."
|
||||
`Attempted to respond to fake XMLHttpRequest with ${body}, which is not a string or ArrayBuffer.`
|
||||
);
|
||||
error.name = "InvalidBodyException";
|
||||
}
|
||||
} else if (!isString) {
|
||||
error = new Error(
|
||||
"Attempted to respond to fake XMLHttpRequest with " +
|
||||
body +
|
||||
", which is not a string."
|
||||
`Attempted to respond to fake XMLHttpRequest with ${body}, which is not a string.`
|
||||
);
|
||||
error.name = "InvalidBodyException";
|
||||
}
|
||||
|
|
@ -1006,7 +1016,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
|
||||
function verifyRequestOpened(xhr) {
|
||||
if (xhr.readyState !== FakeXMLHttpRequest.OPENED) {
|
||||
throw new Error("INVALID_STATE_ERR - " + xhr.readyState);
|
||||
throw new Error(`INVALID_STATE_ERR - ${xhr.readyState}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1049,7 +1059,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
throw new Error("Invalid responseType " + responseType);
|
||||
throw new Error(`Invalid responseType ${responseType}`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1198,8 +1208,6 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
false,
|
||||
this
|
||||
);
|
||||
var event, progress;
|
||||
|
||||
if (typeof this.onreadystatechange === "function") {
|
||||
try {
|
||||
this.onreadystatechange(readyStateChangeEvent);
|
||||
|
|
@ -1208,7 +1216,11 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
}
|
||||
}
|
||||
|
||||
if (this.readyState === FakeXMLHttpRequest.DONE) {
|
||||
if (this.readyState !== FakeXMLHttpRequest.DONE) {
|
||||
this.dispatchEvent(readyStateChangeEvent);
|
||||
} else {
|
||||
var event, progress;
|
||||
|
||||
if (this.timedOut || this.aborted || this.status === 0) {
|
||||
progress = { loaded: 0, total: 0 };
|
||||
event =
|
||||
|
|
@ -1238,20 +1250,18 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
this.dispatchEvent(
|
||||
new sinonEvent.ProgressEvent(event, progress, this)
|
||||
);
|
||||
this.dispatchEvent(readyStateChangeEvent);
|
||||
this.dispatchEvent(
|
||||
new sinonEvent.ProgressEvent("loadend", progress, this)
|
||||
);
|
||||
}
|
||||
|
||||
this.dispatchEvent(readyStateChangeEvent);
|
||||
},
|
||||
|
||||
// Ref https://xhr.spec.whatwg.org/#the-setrequestheader()-method
|
||||
setRequestHeader: function setRequestHeader(header, value) {
|
||||
if (typeof value !== "string") {
|
||||
throw new TypeError(
|
||||
"By RFC7230, section 3.2.4, header values should be strings. Got " +
|
||||
typeof value
|
||||
`By RFC7230, section 3.2.4, header values should be strings. Got ${typeof value}`
|
||||
);
|
||||
}
|
||||
verifyState(this);
|
||||
|
|
@ -1268,7 +1278,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
) {
|
||||
throw new Error(
|
||||
// eslint-disable-next-line quotes
|
||||
'Refused to set unsafe header "' + header + '"'
|
||||
`Refused to set unsafe header "${header}"`
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -1277,7 +1287,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
|
||||
var existingHeader = getHeader(this.requestHeaders, header);
|
||||
if (existingHeader) {
|
||||
this.requestHeaders[existingHeader] += ", " + value;
|
||||
this.requestHeaders[existingHeader] += `, ${value}`;
|
||||
} else {
|
||||
this.requestHeaders[header] = value;
|
||||
}
|
||||
|
|
@ -1319,8 +1329,9 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
);
|
||||
if (this.requestHeaders[contentType]) {
|
||||
var value = this.requestHeaders[contentType].split(";");
|
||||
this.requestHeaders[contentType] =
|
||||
value[0] + ";charset=utf-8";
|
||||
this.requestHeaders[
|
||||
contentType
|
||||
] = `${value[0]};charset=utf-8`;
|
||||
} else if (supportsFormData && !(data instanceof FormData)) {
|
||||
this.requestHeaders["Content-Type"] =
|
||||
"text/plain;charset=utf-8";
|
||||
|
|
@ -1425,7 +1436,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
.reduce(function(prev, header) {
|
||||
var value = responseHeaders[header];
|
||||
|
||||
return prev + (header + ": " + value + "\r\n");
|
||||
return `${prev}${header}: ${value}\r\n`;
|
||||
}, "");
|
||||
|
||||
return headers;
|
||||
|
|
@ -1482,6 +1493,8 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
},
|
||||
|
||||
respond: function respond(status, headers, body) {
|
||||
this.responseURL = this.url;
|
||||
|
||||
this.setStatus(status);
|
||||
this.setResponseHeaders(headers || {});
|
||||
this.setResponseBody(body || "");
|
||||
|
|
@ -1599,6 +1612,9 @@ module.exports = {
|
|||
|
||||
var every = require("./prototypes/array").every;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
function hasCallsLeft(callMap, spy) {
|
||||
if (callMap[spy.id] === undefined) {
|
||||
callMap[spy.id] = 0;
|
||||
|
|
@ -1607,6 +1623,9 @@ function hasCallsLeft(callMap, spy) {
|
|||
return callMap[spy.id] < spy.callCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
function checkAdjacentCalls(callMap, spy, index, spies) {
|
||||
var calledBeforeNext = true;
|
||||
|
||||
|
|
@ -1622,20 +1641,43 @@ function checkAdjacentCalls(callMap, spy, index, spies) {
|
|||
return false;
|
||||
}
|
||||
|
||||
module.exports = function calledInOrder(spies) {
|
||||
/**
|
||||
* A Sinon proxy object (fake, spy, stub)
|
||||
*
|
||||
* @typedef {object} SinonProxy
|
||||
* @property {Function} calledBefore - A method that determines if this proxy was called before another one
|
||||
* @property {string} id - Some id
|
||||
* @property {number} callCount - Number of times this proxy has been called
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns true when the spies have been called in the order they were supplied in
|
||||
*
|
||||
* @param {SinonProxy[] | SinonProxy} spies An array of proxies, or several proxies as arguments
|
||||
* @returns {boolean} true when spies are called in order, false otherwise
|
||||
*/
|
||||
function calledInOrder(spies) {
|
||||
var callMap = {};
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
var _spies = arguments.length > 1 ? arguments : spies;
|
||||
|
||||
return every(_spies, checkAdjacentCalls.bind(null, callMap));
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = calledInOrder;
|
||||
|
||||
},{"./prototypes/array":21}],14:[function(require,module,exports){
|
||||
"use strict";
|
||||
|
||||
var functionName = require("./function-name");
|
||||
|
||||
module.exports = function className(value) {
|
||||
/**
|
||||
* Returns a display name for a value from a constructor
|
||||
*
|
||||
* @param {object} value A value to examine
|
||||
* @returns {(string|null)} A string or null
|
||||
*/
|
||||
function className(value) {
|
||||
return (
|
||||
(value.constructor && value.constructor.name) ||
|
||||
// The next branch is for IE11 support only:
|
||||
|
|
@ -1649,14 +1691,22 @@ module.exports = function className(value) {
|
|||
functionName(value.constructor)) ||
|
||||
null
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = className;
|
||||
|
||||
},{"./function-name":17}],15:[function(require,module,exports){
|
||||
/* eslint-disable no-console */
|
||||
"use strict";
|
||||
|
||||
// wrap returns a function that will invoke the supplied function and print a deprecation warning to the console each
|
||||
// time it is called.
|
||||
/**
|
||||
* Returns a function that will invoke the supplied function and print a
|
||||
* deprecation warning to the console each time it is called.
|
||||
*
|
||||
* @param {Function} func
|
||||
* @param {string} msg
|
||||
* @returns {Function}
|
||||
*/
|
||||
exports.wrap = function(func, msg) {
|
||||
var wrapped = function() {
|
||||
exports.printWarning(msg);
|
||||
|
|
@ -1668,8 +1718,14 @@ exports.wrap = function(func, msg) {
|
|||
return wrapped;
|
||||
};
|
||||
|
||||
// defaultMsg returns a string which can be supplied to `wrap()` to notify the user that a particular part of the
|
||||
// sinon API has been deprecated.
|
||||
/**
|
||||
* Returns a string which can be supplied to `wrap()` to notify the user that a
|
||||
* particular part of the sinon API has been deprecated.
|
||||
*
|
||||
* @param {string} packageName
|
||||
* @param {string} funcName
|
||||
* @returns {string}
|
||||
*/
|
||||
exports.defaultMsg = function(packageName, funcName) {
|
||||
return (
|
||||
packageName +
|
||||
|
|
@ -1681,6 +1737,12 @@ exports.defaultMsg = function(packageName, funcName) {
|
|||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Prints a warning on the console, when it exists
|
||||
*
|
||||
* @param {string} msg
|
||||
* @returns {undefined}
|
||||
*/
|
||||
exports.printWarning = function(msg) {
|
||||
// Watch out for IE7 and below! :(
|
||||
/* istanbul ignore next */
|
||||
|
|
@ -1696,7 +1758,14 @@ exports.printWarning = function(msg) {
|
|||
},{}],16:[function(require,module,exports){
|
||||
"use strict";
|
||||
|
||||
// This is an `every` implementation that works for all iterables
|
||||
/**
|
||||
* Returns true when fn returns true for all members of obj.
|
||||
* This is an every implementation that works for all iterables
|
||||
*
|
||||
* @param {object} obj
|
||||
* @param {Function} fn
|
||||
* @returns {boolean}
|
||||
*/
|
||||
module.exports = function every(obj, fn) {
|
||||
var pass = true;
|
||||
|
||||
|
|
@ -1718,6 +1787,12 @@ module.exports = function every(obj, fn) {
|
|||
},{}],17:[function(require,module,exports){
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Returns a display name for a function
|
||||
*
|
||||
* @param {Function} func
|
||||
* @returns {string}
|
||||
*/
|
||||
module.exports = function functionName(func) {
|
||||
if (!func) {
|
||||
return "";
|
||||
|
|
@ -1737,7 +1812,13 @@ module.exports = function functionName(func) {
|
|||
},{}],18:[function(require,module,exports){
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* A reference to the global object
|
||||
*
|
||||
* @type {object} globalObject
|
||||
*/
|
||||
var globalObject;
|
||||
|
||||
/* istanbul ignore else */
|
||||
if (typeof global !== "undefined") {
|
||||
// Node
|
||||
|
|
@ -1774,6 +1855,9 @@ module.exports = {
|
|||
var sort = require("./prototypes/array").sort;
|
||||
var slice = require("./prototypes/array").slice;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
function comparator(a, b) {
|
||||
// uuid, won't ever be equal
|
||||
var aCall = a.getCall(0);
|
||||
|
|
@ -1784,9 +1868,24 @@ function comparator(a, b) {
|
|||
return aId < bId ? -1 : 1;
|
||||
}
|
||||
|
||||
module.exports = function orderByFirstCall(spies) {
|
||||
/**
|
||||
* A Sinon proxy object (fake, spy, stub)
|
||||
*
|
||||
* @typedef {object} SinonProxy
|
||||
* @property {Function} getCall - A method that can return the first call
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sorts an array of SinonProxy instances (fake, spy, stub) by their first call
|
||||
*
|
||||
* @param {SinonProxy[] | SinonProxy} spies
|
||||
* @returns {SinonProxy[]}
|
||||
*/
|
||||
function orderByFirstCall(spies) {
|
||||
return sort(slice(spies), comparator);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = orderByFirstCall;
|
||||
|
||||
},{"./prototypes/array":21}],21:[function(require,module,exports){
|
||||
"use strict";
|
||||
|
|
@ -1870,6 +1969,12 @@ module.exports = copyPrototype(String.prototype);
|
|||
|
||||
var type = require("type-detect");
|
||||
|
||||
/**
|
||||
* Returns the lower-case result of running type from type-detect on the value
|
||||
*
|
||||
* @param {*} value
|
||||
* @returns {string}
|
||||
*/
|
||||
module.exports = function typeOf(value) {
|
||||
return type(value).toLowerCase();
|
||||
};
|
||||
|
|
@ -1877,6 +1982,12 @@ module.exports = function typeOf(value) {
|
|||
},{"type-detect":39}],30:[function(require,module,exports){
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Returns a string representation of the value
|
||||
*
|
||||
* @param {*} value
|
||||
* @returns {string}
|
||||
*/
|
||||
function valueToString(value) {
|
||||
if (value && value.toString) {
|
||||
/* eslint-disable-next-line local-rules/no-prototype-methods */
|
||||
|
|
@ -1911,6 +2022,7 @@ function withGlobal(_global) {
|
|||
hrtimePresent && typeof _global.process.hrtime.bigint === "function";
|
||||
var nextTickPresent =
|
||||
_global.process && typeof _global.process.nextTick === "function";
|
||||
var utilPromisify = _global.process && require("util").promisify;
|
||||
var performancePresent =
|
||||
_global.performance && typeof _global.performance.now === "function";
|
||||
var hasPerformancePrototype =
|
||||
|
|
@ -2633,6 +2745,21 @@ function withGlobal(_global) {
|
|||
delay: timeout
|
||||
});
|
||||
};
|
||||
if (typeof _global.Promise !== "undefined" && utilPromisify) {
|
||||
clock.setTimeout[
|
||||
utilPromisify.custom
|
||||
] = function promisifiedSetTimeout(timeout, arg) {
|
||||
return new _global.Promise(function setTimeoutExecutor(
|
||||
resolve
|
||||
) {
|
||||
addTimer(clock, {
|
||||
func: resolve,
|
||||
args: [arg],
|
||||
delay: timeout
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
clock.clearTimeout = function clearTimeout(timerId) {
|
||||
return clearTimer(clock, timerId, "Timeout");
|
||||
|
|
@ -2673,6 +2800,22 @@ function withGlobal(_global) {
|
|||
});
|
||||
};
|
||||
|
||||
if (typeof _global.Promise !== "undefined" && utilPromisify) {
|
||||
clock.setImmediate[
|
||||
utilPromisify.custom
|
||||
] = function promisifiedSetImmediate(arg) {
|
||||
return new _global.Promise(function setImmediateExecutor(
|
||||
resolve
|
||||
) {
|
||||
addTimer(clock, {
|
||||
func: resolve,
|
||||
args: [arg],
|
||||
immediate: true
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
clock.clearImmediate = function clearImmediate(timerId) {
|
||||
return clearTimer(clock, timerId, "Immediate");
|
||||
};
|
||||
|
|
@ -3175,7 +3318,7 @@ exports.createClock = defaultImplementation.createClock;
|
|||
exports.install = defaultImplementation.install;
|
||||
exports.withGlobal = withGlobal;
|
||||
|
||||
},{"@sinonjs/commons":19}],32:[function(require,module,exports){
|
||||
},{"@sinonjs/commons":19,"util":41}],32:[function(require,module,exports){
|
||||
// This is free and unencumbered software released into the public domain.
|
||||
// See LICENSE.md for more information.
|
||||
|
||||
|
|
@ -6616,7 +6759,7 @@ function extend(/* [deep], obj1, obj2, [objn] */) {
|
|||
deep = args.shift();
|
||||
}
|
||||
var result = args[0];
|
||||
if (!result || (typeof result != 'object' && typeof result != 'function')) {
|
||||
if (isUnextendable(result)) {
|
||||
throw new Error('extendee must be an object');
|
||||
}
|
||||
var extenders = args.slice(1);
|
||||
|
|
@ -6628,7 +6771,13 @@ function extend(/* [deep], obj1, obj2, [objn] */) {
|
|||
var value = extender[key];
|
||||
if (deep && isCloneable(value)) {
|
||||
var base = Array.isArray(value) ? [] : {};
|
||||
result[key] = extend(true, result.hasOwnProperty(key) ? result[key] : base, value);
|
||||
result[key] = extend(
|
||||
true,
|
||||
result.hasOwnProperty(key) && !isUnextendable(result[key])
|
||||
? result[key]
|
||||
: base,
|
||||
value
|
||||
);
|
||||
} else {
|
||||
result[key] = value;
|
||||
}
|
||||
|
|
@ -6642,6 +6791,10 @@ function isCloneable(obj) {
|
|||
return Array.isArray(obj) || {}.toString.call(obj) == '[object Object]';
|
||||
}
|
||||
|
||||
function isUnextendable(val) {
|
||||
return !val || (typeof val != 'object' && typeof val != 'function');
|
||||
}
|
||||
|
||||
},{}],38:[function(require,module,exports){
|
||||
var isarray = require('isarray')
|
||||
|
||||
|
|
|
|||
27
node_modules/nise/package.json
generated
vendored
27
node_modules/nise/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "nise",
|
||||
"version": "4.0.3",
|
||||
"version": "5.1.0",
|
||||
"description": "Fake XHR and server",
|
||||
"keywords": [
|
||||
"test",
|
||||
|
|
@ -19,7 +19,9 @@
|
|||
"scripts": {
|
||||
"bundle": "browserify --no-detect-globals -s nise -o nise.js lib/index.js",
|
||||
"lint": "eslint .",
|
||||
"prepublish": "npm run bundle",
|
||||
"prettier:check": "prettier --check '**/*.{js,css,md}'",
|
||||
"prettier:write": "prettier --write '**/*.{js,css,md}'",
|
||||
"prepare": "npm run bundle",
|
||||
"prepublishOnly": "mkdocs gh-deploy -r upstream || mkdocs gh-deploy -r origin",
|
||||
"test": "mocha lib/**/*.test.js",
|
||||
"test:coverage": "nyc --reporter=lcov --reporter=text --all npm test -- --reporter dot",
|
||||
|
|
@ -43,17 +45,13 @@
|
|||
"lib/**/*.js"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@sinonjs/referee": "^4.0.0",
|
||||
"@sinonjs/eslint-config": "^4.0.0",
|
||||
"@sinonjs/referee": "^5.0.0",
|
||||
"browserify": "^16.2.3",
|
||||
"eslint": "^6.1.0",
|
||||
"eslint-config-prettier": "^6.9.0",
|
||||
"eslint-config-sinon": "^3.0.1",
|
||||
"eslint-plugin-ie11": "1.0.0",
|
||||
"eslint-plugin-mocha": "^6.1.1",
|
||||
"eslint-plugin-prettier": "^3.1.2",
|
||||
"husky": "^4.2.1",
|
||||
"jsdom": "^15.1.1",
|
||||
"jsdom": "^16.2.0",
|
||||
"jsdom-global": "3.0.2",
|
||||
"lint-staged": "^10.5.3",
|
||||
"mocha": "^7.0.1",
|
||||
"mochify": "^6.6.0",
|
||||
"nyc": "^15.0.0",
|
||||
|
|
@ -65,15 +63,18 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@sinonjs/commons": "^1.7.0",
|
||||
"@sinonjs/fake-timers": "^6.0.0",
|
||||
"@sinonjs/fake-timers": "^7.0.4",
|
||||
"@sinonjs/text-encoding": "^0.7.1",
|
||||
"just-extend": "^4.0.2",
|
||||
"path-to-regexp": "^1.7.0"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,css,md}": "prettier --check",
|
||||
"*.js": "eslint --quiet"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "npm run lint -- --fix && npm run test",
|
||||
"pre-push": "npm run lint && npm run test"
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue