-
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
303 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* eslint-disable */ | ||
const JSDOMEnvironment = require('jest-environment-jsdom'); | ||
|
||
// Custom test environment copied from https://github.com/jsdom/jsdom/issues/2524 | ||
// in order to add TextEncoder to jsdom. TextEncoder is expected by jose. | ||
|
||
module.exports = class CustomTestEnvironment extends JSDOMEnvironment { | ||
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.ArrayBuffer = ArrayBuffer; | ||
this.global.Uint8Array = Uint8Array; | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1 @@ | ||
import 'isomorphic-fetch'; | ||
// eslint-disable-next-line | ||
import { TextDecoder } from 'util'; | ||
|
||
// not sure why this is a type mismatch and has to be type cast to any...? | ||
global.TextDecoder = TextDecoder as any; |
Oops, something went wrong.