[8.9] chore(NA): add Blob polyfill on jest env (#162197) (#162351)

# Backport

This will backport the following commits from `main` to `8.9`:
- [chore(NA): add Blob polyfill on jest env
(#162197)](https://github.com/elastic/kibana/pull/162197)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Tiago
Costa","email":"tiago.costa@elastic.co"},"sourceCommit":{"committedDate":"2023-07-20T17:30:43Z","message":"chore(NA):
add Blob polyfill on jest env (#162197)\n\nThis PR adds the `Blob`
polyfill into the jest jsdom env which is\r\ncurrently not supported as
mentioned
in\r\nhttps://github.com/jsdom/jsdom/issues/2555\r\n\r\n---------\r\n\r\nCo-authored-by:
Thomas Watson <w@tson.dk>\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"e9a651933768353e65c2c4e52b98b768bb7f3b27","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["chore","Team:Operations","release_note:skip","backport:all-open","v8.10.0"],"number":162197,"url":"https://github.com/elastic/kibana/pull/162197","mergeCommit":{"message":"chore(NA):
add Blob polyfill on jest env (#162197)\n\nThis PR adds the `Blob`
polyfill into the jest jsdom env which is\r\ncurrently not supported as
mentioned
in\r\nhttps://github.com/jsdom/jsdom/issues/2555\r\n\r\n---------\r\n\r\nCo-authored-by:
Thomas Watson <w@tson.dk>\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"e9a651933768353e65c2c4e52b98b768bb7f3b27"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/162197","number":162197,"mergeCommit":{"message":"chore(NA):
add Blob polyfill on jest env (#162197)\n\nThis PR adds the `Blob`
polyfill into the jest jsdom env which is\r\ncurrently not supported as
mentioned
in\r\nhttps://github.com/jsdom/jsdom/issues/2555\r\n\r\n---------\r\n\r\nCo-authored-by:
Thomas Watson <w@tson.dk>\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"e9a651933768353e65c2c4e52b98b768bb7f3b27"}}]}]
BACKPORT-->

Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
This commit is contained in:
Kibana Machine 2023-07-20 14:47:22 -04:00 committed by GitHub
parent 23efa62b78
commit 337d636938
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

View file

@ -1369,6 +1369,7 @@
"babel-plugin-styled-components": "^2.0.7",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"backport": "^8.9.7",
"blob-polyfill": "^7.0.20220408",
"callsites": "^3.1.0",
"chance": "1.0.18",
"chromedriver": "^114.0.2",

View file

@ -21,3 +21,10 @@ if (!global.hasOwnProperty('TextEncoder')) {
global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder;
}
// NOTE: We should evaluate removing this once we upgrade to Node 18 and find out if loaders.gl already fixed this usage
// or instead check if we can use the official Blob implementation.
// This is needed for x-pack/plugins/file_upload/public/importer/geo/geojson_importer/geojson_importer.test.js
//
// https://github.com/jsdom/jsdom/issues/2555
global.Blob = require('blob-polyfill').Blob;

View file

@ -11364,6 +11364,11 @@ bl@^5.0.0:
inherits "^2.0.4"
readable-stream "^3.4.0"
blob-polyfill@^7.0.20220408:
version "7.0.20220408"
resolved "https://registry.yarnpkg.com/blob-polyfill/-/blob-polyfill-7.0.20220408.tgz#38bf5e046c41a21bb13654d9d19f303233b8218c"
integrity sha512-oD8Ydw+5lNoqq+en24iuPt1QixdPpe/nUF8azTHnviCZYu9zUC+TwdzIp5orpblJosNlgNbVmmAb//c6d6ImUQ==
blob-util@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/blob-util/-/blob-util-2.0.2.tgz#3b4e3c281111bb7f11128518006cdc60b403a1eb"