mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-08 00:33:12 +00:00
Fix TextDecoder error in tests
This commit is contained in:
parent
7d9f8c03c1
commit
f0fe7dce02
1
.gitignore
vendored
1
.gitignore
vendored
@ -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": {
|
||||||
|
|||||||
12
examples/min-js-web-chat/test/custom-test-env.js
Normal file
12
examples/min-js-web-chat/test/custom-test-env.js
Normal file
@ -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…
x
Reference in New Issue
Block a user