docbrown/customJsDomEnvironment.js
dependabot[bot] c2af21e730
Bump jest from 27.5.1 to 28.1.0 (#17612)
* Bump jest from 27.5.1 to 28.1.0

Bumps [jest](https://github.com/facebook/jest/tree/HEAD/packages/jest) from 27.5.1 to 28.1.0.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v28.1.0/packages/jest)

---
updated-dependencies:
- dependency-name: jest
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* resolve upgrade errors

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-05-10 07:27:36 -04:00

26 lines
671 B
JavaScript

/* eslint-env node */
const Environment = require('jest-environment-jsdom').default;
module.exports = class CustomTestEnvironment extends Environment {
constructor(config, context) {
super(config, context);
}
async setup() {
await super.setup();
// See https://github.com/jsdom/jsdom/issues/2524#issuecomment-736672511
if (typeof this.global.TextEncoder === 'undefined') {
const { TextEncoder, TextDecoder } = require('util');
this.global.TextEncoder = TextEncoder;
this.global.TextDecoder = TextDecoder;
}
}
async teardown() {
await super.teardown();
}
getVmContext() {
return super.getVmContext();
}
};