From 4eaa6e40a22469163d851e4205ff47392a3d4605 Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Thu, 7 Mar 2024 10:52:22 -0500 Subject: [PATCH] build: update mapbox-gl@3.1.2 (#1589) * build: update @mapbox/mapbox-gl-geocoder@5.0.2 mapbox-gl@3.1.2 * fix: define TextDecoder so tests pass with mapbox-gl 3 --- package-lock.json | 14 ++++++++++---- package.json | 2 +- .../components/VisualizationConfigForm.test.js | 8 ++++++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index bd7b1d1bf..2257a8ade 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,7 @@ "js-cookie": "^3.0.5", "jwt-decode": "^4.0.0", "lodash": "^4.17.21", - "mapbox-gl": "^2.15.0", + "mapbox-gl": "^3.1.2", "notistack": "^3.0.1", "path-browserify": "^1.0.1", "query-string": "^7.1.3", @@ -10645,6 +10645,11 @@ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, + "node_modules/cheap-ruler": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/cheap-ruler/-/cheap-ruler-3.0.2.tgz", + "integrity": "sha512-02T332h1/HTN6cDSufLP8x4JzDs2+VC+8qZ/N0kWIVPyc2xUkWwWh3B2fJxR7raXkL4Mq7k554mfuM9ofv/vGg==" + }, "node_modules/check-types": { "version": "11.2.3", "resolved": "https://registry.npmjs.org/check-types/-/check-types-11.2.3.tgz", @@ -21768,9 +21773,9 @@ } }, "node_modules/mapbox-gl": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-2.15.0.tgz", - "integrity": "sha512-fjv+aYrd5TIHiL7wRa+W7KjtUqKWziJMZUkK5hm8TvJ3OLeNPx4NmW/DgfYhd/jHej8wWL+QJBDbdMMAKvNC0A==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-3.1.2.tgz", + "integrity": "sha512-+KoLEqZM8GxO/ViPz9tKgGURteKne+Y0pXiVCNsowymiZFH3FiL6dt9oZE95owMg5XqD3Kygz5mfchR1ZgmWlA==", "dependencies": { "@mapbox/geojson-rewind": "^0.5.2", "@mapbox/jsonlint-lines-primitives": "^2.0.2", @@ -21780,6 +21785,7 @@ "@mapbox/unitbezier": "^0.0.1", "@mapbox/vector-tile": "^1.3.1", "@mapbox/whoots-js": "^3.1.0", + "cheap-ruler": "^3.0.1", "csscolorparser": "~1.0.3", "earcut": "^2.2.4", "geojson-vt": "^3.2.1", diff --git a/package.json b/package.json index 62f3b06ef..1e73c3b67 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "js-cookie": "^3.0.5", "jwt-decode": "^4.0.0", "lodash": "^4.17.21", - "mapbox-gl": "^2.15.0", + "mapbox-gl": "^3.1.2", "notistack": "^3.0.1", "path-browserify": "^1.0.1", "query-string": "^7.1.3", diff --git a/src/sharedData/visualization/components/VisualizationConfigForm.test.js b/src/sharedData/visualization/components/VisualizationConfigForm.test.js index 8b97993f7..12149f50f 100644 --- a/src/sharedData/visualization/components/VisualizationConfigForm.test.js +++ b/src/sharedData/visualization/components/VisualizationConfigForm.test.js @@ -14,6 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. */ +import * as util from 'util'; import { act, fireEvent, render, screen, waitFor, within } from 'tests/utils'; import { useParams } from 'react-router-dom'; import * as terrasoApi from 'terraso-client-shared/terrasoApi/api'; @@ -29,6 +30,13 @@ import { MAP_DATA_ACCEPTED_EXTENSIONS, } from 'config'; +// mapbox-gl 3.x no longer has TextDecoder defined +// https://github.com/mapbox/mapbox-gl-js/issues/13027 +Object.defineProperty(window, 'TextDecoder', { + writable: true, + value: util.TextDecoder, +}); + jest.mock('terraso-client-shared/terrasoApi/api'); jest.mock('sharedData/visualization/visualizationMarkers'); jest.mock('react-router-dom', () => ({