dfad7b89ab
* fix: esm/cjs exports * fix: guard visibility state WebAPI * fix: nextjs styled-components imports * fix: add ethers' optional deps * fix: document access in useHasFocus * fix: suffix babel-plugin-macros config for commonjs * chore: rollup sourcemaps * chore: export fonts separately * chore: mv redux to peer dep * fix: run tests off cjs config * fix: run cosmos off cjs config
17 lines
580 B
JavaScript
17 lines
580 B
JavaScript
// Custom test environment to provide `TextEncoder`/`TextDecoder`
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
const Environment = require('jest-environment-jsdom')
|
|
|
|
module.exports = class CustomTestEnvironment extends Environment {
|
|
async setup() {
|
|
await super.setup()
|
|
if (typeof this.global.TextEncoder === 'undefined') {
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
const { TextEncoder, TextDecoder } = require('util')
|
|
this.global.TextEncoder = TextEncoder
|
|
this.global.TextDecoder = TextDecoder
|
|
}
|
|
}
|
|
}
|