Skip to content

Commit

Permalink
fix(jsdom): set up jest for jsdom
Browse files Browse the repository at this point in the history
  • Loading branch information
krishna-acondy committed Aug 27, 2021
1 parent 4b627fe commit 7918512
Show file tree
Hide file tree
Showing 5 changed files with 307 additions and 47 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

jest.config.js
jest.server.config.js
jest.env.js
test.sh
*.spec.ts
*.spec.server.ts
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ module.exports = {
// runner: "jest-runner",

// The paths to modules that run some code to configure or set up the testing environment before each test
setupFiles: [],
setupFiles: ['./jest.env.js'],

// A list of paths to modules that run some code to configure or set up the testing framework before each test
setupFilesAfterEnv: ['jest-extended'],
Expand Down
4 changes: 4 additions & 0 deletions jest.env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Define global TextEncoder and TextDecoder for `jsdom`
const { TextEncoder, TextDecoder } = require('util')
global.TextEncoder = TextEncoder
global.TextDecoder = TextDecoder

0 comments on commit 7918512

Please sign in to comment.