mirror of https://github.com/waku-org/js-waku.git
Fix TextDecoder error in tests
This commit is contained in:
parent
7d9f8c03c1
commit
f0fe7dce02
|
@ -2,7 +2,6 @@
|
||||||
.nyc_output
|
.nyc_output
|
||||||
build
|
build
|
||||||
node_modules
|
node_modules
|
||||||
test
|
|
||||||
src/**.js
|
src/**.js
|
||||||
coverage
|
coverage
|
||||||
*.log
|
*.log
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "react-scripts start",
|
"start": "react-scripts start",
|
||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
"test": "react-scripts test",
|
"test": "react-scripts test --env=./test/custom-test-env.js",
|
||||||
"eject": "react-scripts eject"
|
"eject": "react-scripts eject"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
const Environment = require('jest-environment-jsdom');
|
||||||
|
|
||||||
|
module.exports = class CustomTestEnvironment extends Environment {
|
||||||
|
async setup() {
|
||||||
|
await super.setup();
|
||||||
|
if (typeof this.global.TextEncoder === 'undefined') {
|
||||||
|
const { TextEncoder, TextDecoder } = require('util');
|
||||||
|
this.global.TextEncoder = TextEncoder;
|
||||||
|
this.global.TextDecoder = TextDecoder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in New Issue