Skip to content

Commit

Permalink
Feat(jest-config): Mock TextEncoder and TextDecoder in DOM
Browse files Browse the repository at this point in the history
  • Loading branch information
literat authored and curdaj committed Oct 22, 2024
1 parent 12c77b8 commit 8aa78d8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions configs/jest-config-spirit/jsdom/setup/setupAfterEnv.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import '@testing-library/jest-dom';
// eslint-disable-next-line import/no-extraneous-dependencies
import { TextEncoder, TextDecoder } from 'util';
import ResizeObserverPolyfill from 'resize-observer-polyfill';

/**
Expand All @@ -18,3 +17,8 @@ global.ResizeObserver = ResizeObserverPolyfill;
* Also consider better patching of the Console.
* @see { @link https://github.com/carbon-design-system/carbon/blob/main/config/jest-config-carbon/setup/setupAfterEnv.js }
*/

/**
* While it should be bundled with jsdom, it isn't with jsdom 16.
*/
Object.assign(global, { TextDecoder, TextEncoder });

0 comments on commit 8aa78d8

Please sign in to comment.