diff --git a/jest-setup.js b/jest-setup.js index 35a700b..264e914 100644 --- a/jest-setup.js +++ b/jest-setup.js @@ -1,2 +1,9 @@ // Jest setup provided by Grafana scaffolding import './.config/jest-setup'; + +import { TextDecoder, TextEncoder } from 'util'; + +/** + * Assign Text Decoder and Encoder which are required in @grafana/ui + */ +Object.assign(global, { TextDecoder, TextEncoder }); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 8ec5b6a..77a30cf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -68,6 +68,7 @@ "ts-node": "^10.9.2", "tsconfig-paths": "^4.2.0", "typescript": "5.3.3", + "util": "^0.12.5", "webpack": "^5.90.1", "webpack-cli": "^5.1.4", "webpack-livereload-plugin": "^3.0.2" @@ -19919,6 +19920,19 @@ "react": "^16.8.0 || ^17.0.0 || ^18.0.0" } }, + "node_modules/util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/package.json b/package.json index 0ae24a7..43867d3 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "ts-node": "^10.9.2", "tsconfig-paths": "^4.2.0", "typescript": "5.3.3", + "util": "^0.12.5", "webpack": "^5.90.1", "webpack-cli": "^5.1.4", "webpack-livereload-plugin": "^3.0.2"