Skip to content

Commit

Permalink
chore: initial TS tests config
Browse files Browse the repository at this point in the history
JIRA: UUI-767
  • Loading branch information
michal-oleniacz-stp committed Feb 21, 2024
1 parent 4701201 commit 8c85f3d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion jest.config.js → jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
export default {
preset: 'ts-jest',
testEnvironmentOptions: {
url: 'http://spid.no'
},
testPathIgnorePatterns: [
'__tests__/utils.js',
],
testEnvironment: "./jest.test-env.js",
testEnvironment: "./jest.test-env.ts",
transform: {
"^.+\\.(js)$": "babel-jest",
'^.+\\.ts?$': 'ts-jest',
},
globals: {
fetch: global.fetch,
Expand Down
6 changes: 3 additions & 3 deletions jest.test-env.js → jest.test-env.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { TextEncoder, TextDecoder } from 'util';
import pkg from 'jest-environment-jsdom';
const { default: JSDOMEnvironment } = pkg;
import JSDOMEnvironment from 'jest-environment-jsdom';

/**
* Custom Jest env with missing definitions
* https://github.com/jsdom/jsdom/issues/2524
*/
export default class CustomJsDomEnv extends JSDOMEnvironment {
// eslint-disable-next-line require-jsdoc
constructor(...args) {
constructor(...args: unknown[]) {
//@ts-ignore
const { global } = super(...args);
if (!global.TextEncoder)
global.TextEncoder = TextEncoder;
Expand Down

0 comments on commit 8c85f3d

Please sign in to comment.