Bump the npm group with 3 updates (#2303)
* --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm - dependency-name: sinon dependency-type: direct:development update-type: version-update:semver-major dependency-group: npm ... Signed-off-by: dependabot[bot] <support@github.com> * Update checked-in dependencies --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
ebd27c09f6
commit
b1bd8da5e7
212 changed files with 11182 additions and 16383 deletions
2
node_modules/nise/lib/fake-xhr/blob.js
generated
vendored
2
node_modules/nise/lib/fake-xhr/blob.js
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
exports.isSupported = (function() {
|
||||
exports.isSupported = (function () {
|
||||
try {
|
||||
return Boolean(new Blob());
|
||||
} catch (e) {
|
||||
|
|
|
|||
111
node_modules/nise/lib/fake-xhr/index.js
generated
vendored
111
node_modules/nise/lib/fake-xhr/index.js
generated
vendored
|
|
@ -23,7 +23,7 @@ function getWorkingXHR(globalScope) {
|
|||
|
||||
var supportsActiveX = typeof globalScope.ActiveXObject !== "undefined";
|
||||
if (supportsActiveX) {
|
||||
return function() {
|
||||
return function () {
|
||||
return new globalScope.ActiveXObject("MSXML2.XMLHTTP.3.0");
|
||||
};
|
||||
}
|
||||
|
|
@ -54,7 +54,7 @@ var unsafeHeaders = {
|
|||
"Transfer-Encoding": true,
|
||||
Upgrade: true,
|
||||
"User-Agent": true,
|
||||
Via: true
|
||||
Via: true,
|
||||
};
|
||||
|
||||
function EventTargetHandler() {
|
||||
|
|
@ -66,11 +66,11 @@ function EventTargetHandler() {
|
|||
"error",
|
||||
"load",
|
||||
"timeout",
|
||||
"loadend"
|
||||
"loadend",
|
||||
];
|
||||
|
||||
function addEventListener(eventName) {
|
||||
self.addEventListener(eventName, function(event) {
|
||||
self.addEventListener(eventName, function (event) {
|
||||
var listener = self[`on${eventName}`];
|
||||
|
||||
if (listener && typeof listener === "function") {
|
||||
|
|
@ -91,7 +91,7 @@ function normalizeHeaderValue(value) {
|
|||
}
|
||||
|
||||
function getHeader(headers, header) {
|
||||
var foundHeader = Object.keys(headers).filter(function(h) {
|
||||
var foundHeader = Object.keys(headers).filter(function (h) {
|
||||
return h.toLowerCase() === header.toLowerCase();
|
||||
});
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ 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";
|
||||
}
|
||||
|
|
@ -121,13 +121,13 @@ function verifyResponseBodyType(body, responseType) {
|
|||
!(body instanceof Blob)
|
||||
) {
|
||||
error = new Error(
|
||||
`Attempted to respond to fake XMLHttpRequest with ${body}, which is not a string, ArrayBuffer, or Blob.`
|
||||
`Attempted to respond to fake XMLHttpRequest with ${body}, which is not a string, ArrayBuffer, or Blob.`,
|
||||
);
|
||||
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";
|
||||
}
|
||||
|
|
@ -220,7 +220,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
}
|
||||
|
||||
// largest arity in XHR is 5 - XHR#open
|
||||
var apply = function(obj, method, args) {
|
||||
var apply = function (obj, method, args) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
return obj[method]();
|
||||
|
|
@ -254,14 +254,14 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
"getAllResponseHeaders",
|
||||
"addEventListener",
|
||||
"overrideMimeType",
|
||||
"removeEventListener"
|
||||
].forEach(function(method) {
|
||||
fakeXhr[method] = function() {
|
||||
"removeEventListener",
|
||||
].forEach(function (method) {
|
||||
fakeXhr[method] = function () {
|
||||
return apply(xhr, method, arguments);
|
||||
};
|
||||
});
|
||||
|
||||
fakeXhr.send = function() {
|
||||
fakeXhr.send = function () {
|
||||
// Ref: https://xhr.spec.whatwg.org/#the-responsetype-attribute
|
||||
if (xhr.responseType !== fakeXhr.responseType) {
|
||||
xhr.responseType = fakeXhr.responseType;
|
||||
|
|
@ -269,13 +269,13 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
return apply(xhr, "send", arguments);
|
||||
};
|
||||
|
||||
var copyAttrs = function(args) {
|
||||
args.forEach(function(attr) {
|
||||
var copyAttrs = function (args) {
|
||||
args.forEach(function (attr) {
|
||||
fakeXhr[attr] = xhr[attr];
|
||||
});
|
||||
};
|
||||
|
||||
var stateChangeStart = function() {
|
||||
var stateChangeStart = function () {
|
||||
fakeXhr.readyState = xhr.readyState;
|
||||
if (xhr.readyState >= FakeXMLHttpRequest.HEADERS_RECEIVED) {
|
||||
copyAttrs(["status", "statusText"]);
|
||||
|
|
@ -294,12 +294,12 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
}
|
||||
};
|
||||
|
||||
var stateChangeEnd = function() {
|
||||
var stateChangeEnd = function () {
|
||||
if (fakeXhr.onreadystatechange) {
|
||||
// eslint-disable-next-line no-useless-call
|
||||
fakeXhr.onreadystatechange.call(fakeXhr, {
|
||||
target: fakeXhr,
|
||||
currentTarget: fakeXhr
|
||||
currentTarget: fakeXhr,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -312,12 +312,12 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
if (xhr.addEventListener) {
|
||||
xhr.addEventListener("readystatechange", stateChangeStart);
|
||||
|
||||
Object.keys(fakeXhr.eventListeners).forEach(function(event) {
|
||||
Object.keys(fakeXhr.eventListeners).forEach(function (event) {
|
||||
/*eslint-disable no-loop-func*/
|
||||
fakeXhr.eventListeners[event].forEach(function(handler) {
|
||||
fakeXhr.eventListeners[event].forEach(function (handler) {
|
||||
xhr.addEventListener(event, handler.listener, {
|
||||
capture: handler.capture,
|
||||
once: handler.once
|
||||
once: handler.once,
|
||||
});
|
||||
});
|
||||
/*eslint-enable no-loop-func*/
|
||||
|
|
@ -436,7 +436,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
|
||||
return result.getElementsByTagNameNS(
|
||||
parsererrorNS,
|
||||
"parsererror"
|
||||
"parsererror",
|
||||
).length
|
||||
? null
|
||||
: result;
|
||||
|
|
@ -495,7 +495,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
502: "Bad Gateway",
|
||||
503: "Service Unavailable",
|
||||
504: "Gateway Timeout",
|
||||
505: "HTTP Version Not Supported"
|
||||
505: "HTTP Version Not Supported",
|
||||
};
|
||||
|
||||
extend(FakeXMLHttpRequest.prototype, sinonEvent.EventTarget, {
|
||||
|
|
@ -513,7 +513,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
|
||||
if (FakeXMLHttpRequest.useFilters === true) {
|
||||
var xhrArgs = arguments;
|
||||
var defake = FakeXMLHttpRequest.filters.some(function(filter) {
|
||||
var defake = FakeXMLHttpRequest.filters.some(function (filter) {
|
||||
return filter.apply(this, xhrArgs);
|
||||
});
|
||||
if (defake) {
|
||||
|
|
@ -531,7 +531,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
"readystatechange",
|
||||
false,
|
||||
false,
|
||||
this
|
||||
this,
|
||||
);
|
||||
if (typeof this.onreadystatechange === "function") {
|
||||
try {
|
||||
|
|
@ -559,25 +559,29 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
|
||||
if (supportsProgress) {
|
||||
this.upload.dispatchEvent(
|
||||
new sinonEvent.ProgressEvent("progress", progress, this)
|
||||
new sinonEvent.ProgressEvent(
|
||||
"progress",
|
||||
progress,
|
||||
this,
|
||||
),
|
||||
);
|
||||
this.upload.dispatchEvent(
|
||||
new sinonEvent.ProgressEvent(event, progress, this)
|
||||
new sinonEvent.ProgressEvent(event, progress, this),
|
||||
);
|
||||
this.upload.dispatchEvent(
|
||||
new sinonEvent.ProgressEvent("loadend", progress, this)
|
||||
new sinonEvent.ProgressEvent("loadend", progress, this),
|
||||
);
|
||||
}
|
||||
|
||||
this.dispatchEvent(
|
||||
new sinonEvent.ProgressEvent("progress", progress, this)
|
||||
new sinonEvent.ProgressEvent("progress", progress, this),
|
||||
);
|
||||
this.dispatchEvent(
|
||||
new sinonEvent.ProgressEvent(event, progress, this)
|
||||
new sinonEvent.ProgressEvent(event, progress, this),
|
||||
);
|
||||
this.dispatchEvent(readyStateChangeEvent);
|
||||
this.dispatchEvent(
|
||||
new sinonEvent.ProgressEvent("loadend", progress, this)
|
||||
new sinonEvent.ProgressEvent("loadend", progress, this),
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
@ -586,7 +590,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
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);
|
||||
|
|
@ -603,7 +607,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
) {
|
||||
throw new Error(
|
||||
// eslint-disable-next-line quotes
|
||||
`Refused to set unsafe header "${header}"`
|
||||
`Refused to set unsafe header "${header}"`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -632,7 +636,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
|
||||
var responseHeaders = (this.responseHeaders = {});
|
||||
|
||||
Object.keys(headers).forEach(function(header) {
|
||||
Object.keys(headers).forEach(function (header) {
|
||||
responseHeaders[header] = headers[header];
|
||||
});
|
||||
|
||||
|
|
@ -650,13 +654,12 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
if (!/^(head)$/i.test(this.method)) {
|
||||
var contentType = getHeader(
|
||||
this.requestHeaders,
|
||||
"Content-Type"
|
||||
"Content-Type",
|
||||
);
|
||||
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";
|
||||
|
|
@ -687,7 +690,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
// is in flight, so we must check anytime the end user forces a clock tick to make
|
||||
// sure timeout hasn't changed.
|
||||
// https://xhr.spec.whatwg.org/#dfnReturnLink-2
|
||||
var clearIntervalId = setInterval(function() {
|
||||
var clearIntervalId = setInterval(function () {
|
||||
// Check if the readyState has been reset or is done. If this is the case, there
|
||||
// should be no timeout. This will also prevent aborted requests and
|
||||
// fakeServerWithClock from triggering unnecessary responses.
|
||||
|
|
@ -709,7 +712,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
}
|
||||
|
||||
this.dispatchEvent(
|
||||
new sinonEvent.Event("loadstart", false, false, this)
|
||||
new sinonEvent.Event("loadstart", false, false, this),
|
||||
);
|
||||
},
|
||||
|
||||
|
|
@ -719,7 +722,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
this.readyState = FakeXMLHttpRequest.UNSENT;
|
||||
},
|
||||
|
||||
error: function() {
|
||||
error: function () {
|
||||
clearResponse(this);
|
||||
this.errorFlag = true;
|
||||
this.requestHeaders = {};
|
||||
|
|
@ -758,7 +761,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
var responseHeaders = this.responseHeaders;
|
||||
var headers = Object.keys(responseHeaders)
|
||||
.filter(excludeSetCookie2Header)
|
||||
.reduce(function(prev, header) {
|
||||
.reduce(function (prev, header) {
|
||||
var value = responseHeaders[header];
|
||||
|
||||
return `${prev}${header}: ${value}\r\n`;
|
||||
|
|
@ -788,7 +791,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
if (isTextResponse) {
|
||||
this.responseText = this.response += body.substring(
|
||||
index,
|
||||
index + chunkSize
|
||||
index + chunkSize,
|
||||
);
|
||||
}
|
||||
index += chunkSize;
|
||||
|
|
@ -798,7 +801,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
this.response = convertResponseBody(
|
||||
this.responseType,
|
||||
contentType,
|
||||
body
|
||||
body,
|
||||
);
|
||||
if (isTextResponse) {
|
||||
this.responseText = this.response;
|
||||
|
|
@ -811,7 +814,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
isXmlContentType(contentType)
|
||||
) {
|
||||
this.responseXML = FakeXMLHttpRequest.parseXML(
|
||||
this.responseText
|
||||
this.responseText,
|
||||
);
|
||||
}
|
||||
this.readyStateChange(FakeXMLHttpRequest.DONE);
|
||||
|
|
@ -831,8 +834,8 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
new sinonEvent.ProgressEvent(
|
||||
"progress",
|
||||
progressEventRaw,
|
||||
this.upload
|
||||
)
|
||||
this.upload,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
@ -843,8 +846,8 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
new sinonEvent.ProgressEvent(
|
||||
"progress",
|
||||
progressEventRaw,
|
||||
this
|
||||
)
|
||||
this,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
@ -852,7 +855,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
uploadError: function uploadError(error) {
|
||||
if (supportsCustomEvent) {
|
||||
this.upload.dispatchEvent(
|
||||
new sinonEvent.CustomEvent("error", { detail: error })
|
||||
new sinonEvent.CustomEvent("error", { detail: error }),
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
@ -862,7 +865,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
throw new Error("INVALID_STATE_ERR");
|
||||
}
|
||||
this.overriddenMimeType = type;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
var states = {
|
||||
|
|
@ -870,7 +873,7 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
OPENED: 1,
|
||||
HEADERS_RECEIVED: 2,
|
||||
LOADING: 3,
|
||||
DONE: 4
|
||||
DONE: 4,
|
||||
};
|
||||
|
||||
extend(FakeXMLHttpRequest, states);
|
||||
|
|
@ -915,10 +918,10 @@ function fakeXMLHttpRequestFor(globalScope) {
|
|||
return {
|
||||
xhr: sinonXhr,
|
||||
FakeXMLHttpRequest: FakeXMLHttpRequest,
|
||||
useFakeXMLHttpRequest: useFakeXMLHttpRequest
|
||||
useFakeXMLHttpRequest: useFakeXMLHttpRequest,
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = extend(fakeXMLHttpRequestFor(globalObject), {
|
||||
fakeXMLHttpRequestFor: fakeXMLHttpRequestFor
|
||||
fakeXMLHttpRequestFor: fakeXMLHttpRequestFor,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue