parent
a866df62ed
commit
fe1b682bed
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,5 @@ |
||||
const sharedConfig = require("../../jest.config.js"); |
||||
module.exports = { |
||||
...sharedConfig, |
||||
preset: "ts-jest/presets/js-with-ts", |
||||
testEnvironment: "jsdom", |
||||
rootDir: "./", |
||||
transformIgnorePatterns: ["undici"], |
||||
injectGlobals: true, |
||||
testEnvironment: "<rootDir>/test/environment/customEnvironment.ts", |
||||
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"], |
||||
}; |
||||
|
@ -1,2 +1,2 @@ |
||||
import "@inrupt/jest-jsdom-polyfills"; |
||||
globalThis.fetch = async () => new Response(); |
||||
globalThis.fetch = async () => new Response(); |
@ -1,14 +0,0 @@ |
||||
import Environment from "jest-environment-jsdom"; |
||||
|
||||
export default class CustomTestEnvironment extends Environment { |
||||
async setup() { |
||||
await super.setup(); |
||||
if (typeof this.global.TextEncoder === "undefined") { |
||||
// The following doesn't work from jest-jsdom-polyfills.
|
||||
// TextEncoder (global or via 'util') references a Uint8Array constructor
|
||||
// different than the global one used by users in tests. This makes sure the
|
||||
// same constructor is referenced by both.
|
||||
this.global.Uint8Array = Uint8Array; |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue