-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PDCL-9709 Fix an engine crash when a large response was received by a…
… fetch call. (#9) * PDCL-9709 Fix an engine crash when a large response was received by a fetch call. * Move lint staged config out of package.json. * npm bin was removed from NPM. Use npx. * Ignore eslit cache file. * Update the files that get added to the NPM package. * Ignore the large response JSON file.
- Loading branch information
Showing
10 changed files
with
52,127 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
src/__tests_helpers__/largeJsonResponse.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ node_modules | |
/coverage | ||
/dist | ||
reactor-turbine-edge-*.tgz | ||
.eslintcache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
$(npm bin)/pretty-quick --staged && $(npm bin)/lint-staged | ||
npx pretty-quick --staged && npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"*.js": [ | ||
"eslint --cache --fix" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,11 +19,6 @@ | |
"url": "http://adobe.com", | ||
"email": "[email protected]" | ||
}, | ||
"lint-staged": { | ||
"*.js": [ | ||
"npm run lint -- --fix" | ||
] | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "[email protected]:adobe/reactor-turbine-edge.git" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
Copyright 2020 Adobe. All rights reserved. | ||
This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. You may obtain a copy | ||
of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under | ||
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
OF ANY KIND, either express or implied. See the License for the specific language | ||
governing permissions and limitations under the License. | ||
*/ | ||
|
||
const largeJson = require('./largeJsonResponse.json'); | ||
|
||
module.exports = (returnStatus = 200, largeResponse = false) => | ||
jest.fn((resource) => { | ||
const response = largeResponse | ||
? JSON.stringify(largeJson) | ||
: `${resource?.url || resource}:arrayBuffer`; | ||
const arrayBuffer = Promise.resolve(new TextEncoder().encode(response)); | ||
|
||
return Promise.resolve({ | ||
clone: () => ({ | ||
arrayBuffer: () => arrayBuffer, | ||
status: returnStatus | ||
}), | ||
arrayBuffer: () => arrayBuffer, | ||
status: returnStatus | ||
}); | ||
}); |
Oops, something went wrong.