[7.17] chore(NA): add Blob polyfill on jest env (#162197) (#162353)

# Backport

This will backport the following commits from `main` to `7.17`:
- [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"}},{"url":"https://github.com/elastic/kibana/pull/162351","number":162351,"branch":"8.9","state":"OPEN"}]}]
BACKPORT-->
This commit is contained in:
Tiago Costa 2023-07-21 14:54:43 +01:00 committed by GitHub
parent 47018eedac
commit 42310ff7cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

View file

@ -669,6 +669,7 @@
"babel-plugin-styled-components": "^2.0.7",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"backport": "^5.6.6",
"blob-polyfill": "^7.0.20220408",
"callsites": "^3.1.0",
"chai": "3.5.0",
"chance": "1.0.18",

View file

@ -25,3 +25,10 @@ if (!global.URL.hasOwnProperty('createObjectURL')) {
// Will be replaced with a better solution in EUI
// https://github.com/elastic/eui/issues/3713
global._isJest = true;
// 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

@ -9074,6 +9074,11 @@ bl@^4.0.1, bl@^4.0.3:
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"