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
76
node_modules/nise/lib/fake-server/index.js
generated
vendored
76
node_modules/nise/lib/fake-server/index.js
generated
vendored
|
|
@ -4,7 +4,7 @@ var fakeXhr = require("../fake-xhr");
|
|||
var push = [].push;
|
||||
var log = require("./log");
|
||||
var configureLogError = require("../configure-logger");
|
||||
var pathToRegexp = require("path-to-regexp");
|
||||
var pathToRegexp = require("path-to-regexp").pathToRegexp;
|
||||
|
||||
var supportsArrayBuffer = typeof ArrayBuffer !== "undefined";
|
||||
|
||||
|
|
@ -18,11 +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]}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ function getDefaultWindowLocation() {
|
|||
var winloc = {
|
||||
hostname: "localhost",
|
||||
port: process.env.PORT || 80,
|
||||
protocol: "http:"
|
||||
protocol: "http:",
|
||||
};
|
||||
winloc.host =
|
||||
winloc.hostname +
|
||||
|
|
@ -94,7 +94,7 @@ function match(response, request) {
|
|||
var args = [request].concat(
|
||||
ru && typeof ru.exec === "function"
|
||||
? ru.exec(requestUrl).slice(1)
|
||||
: []
|
||||
: [],
|
||||
);
|
||||
return response.response.apply(response, args);
|
||||
}
|
||||
|
|
@ -122,7 +122,7 @@ function incrementRequestCount() {
|
|||
}
|
||||
|
||||
var fakeServer = {
|
||||
create: function(config) {
|
||||
create: function (config) {
|
||||
var server = Object.create(this);
|
||||
server.configure(config);
|
||||
this.xhr = fakeXhr.useFakeXMLHttpRequest();
|
||||
|
|
@ -131,8 +131,8 @@ var fakeServer = {
|
|||
server.queue = [];
|
||||
server.responses = [];
|
||||
|
||||
this.xhr.onCreate = function(xhrObj) {
|
||||
xhrObj.unsafeHeadersEnabled = function() {
|
||||
this.xhr.onCreate = function (xhrObj) {
|
||||
xhrObj.unsafeHeadersEnabled = function () {
|
||||
return !(server.unsafeHeadersEnabled === false);
|
||||
};
|
||||
server.addRequest(xhrObj);
|
||||
|
|
@ -141,7 +141,7 @@ var fakeServer = {
|
|||
return server;
|
||||
},
|
||||
|
||||
configure: function(config) {
|
||||
configure: function (config) {
|
||||
var self = this;
|
||||
var allowlist = {
|
||||
autoRespond: true,
|
||||
|
|
@ -149,13 +149,14 @@ var fakeServer = {
|
|||
respondImmediately: true,
|
||||
fakeHTTPMethods: true,
|
||||
logger: true,
|
||||
unsafeHeadersEnabled: true
|
||||
unsafeHeadersEnabled: true,
|
||||
legacyRoutes: true,
|
||||
};
|
||||
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
config = config || {};
|
||||
|
||||
Object.keys(config).forEach(function(setting) {
|
||||
Object.keys(config).forEach(function (setting) {
|
||||
if (setting in allowlist) {
|
||||
self[setting] = config[setting];
|
||||
}
|
||||
|
|
@ -170,13 +171,13 @@ var fakeServer = {
|
|||
|
||||
incrementRequestCount.call(this);
|
||||
|
||||
xhrObj.onSend = function() {
|
||||
xhrObj.onSend = function () {
|
||||
server.handleRequest(this);
|
||||
|
||||
if (server.respondImmediately) {
|
||||
server.respond();
|
||||
} else if (server.autoRespond && !server.responding) {
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
server.responding = false;
|
||||
server.respond();
|
||||
}, server.autoRespondAfter || 10);
|
||||
|
|
@ -189,7 +190,7 @@ var fakeServer = {
|
|||
getHTTPMethod: function getHTTPMethod(request) {
|
||||
if (this.fakeHTTPMethods && /post/i.test(request.method)) {
|
||||
var matches = (request.requestBody || "").match(
|
||||
/_method=([^\b;]+)/
|
||||
/_method=([^\b;]+)/,
|
||||
);
|
||||
return matches ? matches[1] : request.method;
|
||||
}
|
||||
|
|
@ -205,7 +206,7 @@ var fakeServer = {
|
|||
}
|
||||
},
|
||||
|
||||
logger: function() {
|
||||
logger: function () {
|
||||
// no-op; override via configure()
|
||||
},
|
||||
|
||||
|
|
@ -213,6 +214,8 @@ var fakeServer = {
|
|||
|
||||
log: log,
|
||||
|
||||
legacyRoutes: true,
|
||||
|
||||
respondWith: function respondWith(method, url, body) {
|
||||
if (arguments.length === 1 && typeof method !== "function") {
|
||||
this.response = responseArray(method);
|
||||
|
|
@ -236,17 +239,34 @@ var fakeServer = {
|
|||
}
|
||||
|
||||
// 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]}`;
|
||||
if (typeof url === "string" && url !== "") {
|
||||
if (/:[0-9]+\//.test(url)) {
|
||||
var m = url.match(/^(https?:\/\/.*?):([0-9]+\/.*)$/);
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
url = `${m[1]}\\:${m[2]}`;
|
||||
}
|
||||
if (/:\/\//.test(url)) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
url = url.replace("://", "\\://");
|
||||
}
|
||||
if (/\*/.test(url)) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
url = url.replace(/\/\*/g, "/(.*)");
|
||||
}
|
||||
|
||||
if (this.legacyRoutes) {
|
||||
if (url.includes("?")) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
url = url.replace("?", "\\?");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
push.call(this.responses, {
|
||||
method: method,
|
||||
url:
|
||||
typeof url === "string" && url !== "" ? pathToRegexp(url) : url,
|
||||
response: typeof body === "function" ? body : responseArray(body)
|
||||
response: typeof body === "function" ? body : responseArray(body),
|
||||
});
|
||||
},
|
||||
|
||||
|
|
@ -259,7 +279,7 @@ var fakeServer = {
|
|||
var requests = queue.splice(0, queue.length);
|
||||
var self = this;
|
||||
|
||||
requests.forEach(function(request) {
|
||||
requests.forEach(function (request) {
|
||||
self.processRequest(request);
|
||||
});
|
||||
},
|
||||
|
|
@ -324,10 +344,18 @@ var fakeServer = {
|
|||
resetHistory: function resetHistory() {
|
||||
this.requests.length = this.requestCount = 0;
|
||||
|
||||
this.requestedOnce = this.requestedTwice = this.requestedThrice = this.requested = false;
|
||||
this.requestedOnce =
|
||||
this.requestedTwice =
|
||||
this.requestedThrice =
|
||||
this.requested =
|
||||
false;
|
||||
|
||||
this.firstRequest = this.secondRequest = this.thirdRequest = this.lastRequest = null;
|
||||
}
|
||||
this.firstRequest =
|
||||
this.secondRequest =
|
||||
this.thirdRequest =
|
||||
this.lastRequest =
|
||||
null;
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = fakeServer;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue