run tests in node

This commit is contained in:
Pavel Murygin 2021-12-30 13:02:56 +03:00
parent 5dba619a24
commit d474df546f
2 changed files with 1 additions and 15 deletions

View File

@ -1,14 +0,0 @@
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;
this.global.Uint8Array = Uint8Array;
this.global.ArrayBuffer = ArrayBuffer;
}
}
};

View File

@ -1,4 +1,4 @@
module.exports = { module.exports = {
preset: 'ts-jest', preset: 'ts-jest',
testEnvironment: './jest-patched-jsdom.js', testEnvironment: 'node',
}; };