aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--__tests__/FixJSDOMEnvironment.ts18
-rw-r--r--jest.config.ts2
2 files changed, 19 insertions, 1 deletions
diff --git a/__tests__/FixJSDOMEnvironment.ts b/__tests__/FixJSDOMEnvironment.ts
new file mode 100644
index 00000000000..32bf62f5d6e
--- /dev/null
+++ b/__tests__/FixJSDOMEnvironment.ts
@@ -0,0 +1,18 @@
+/**
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+import JSDOMEnvironment from 'jest-environment-jsdom'
+
+// https://github.com/facebook/jest/blob/v29.4.3/website/versioned_docs/version-29.4/Configuration.md#testenvironment-string
+export default class FixJSDOMEnvironment extends JSDOMEnvironment {
+
+ constructor(...args: ConstructorParameters<typeof JSDOMEnvironment>) {
+ super(...args)
+
+ // https://github.com/jsdom/jsdom/issues/3363
+ // 31 ad above switched to vitest and don't have that issue
+ this.global.structuredClone = structuredClone
+ }
+
+}
diff --git a/jest.config.ts b/jest.config.ts
index b2f9617874f..835eb4963a0 100644
--- a/jest.config.ts
+++ b/jest.config.ts
@@ -43,7 +43,7 @@ const config: Config = {
'<rootDir>/__tests__/mock-window.js',
],
- testEnvironment: 'jest-environment-jsdom',
+ testEnvironment: './__tests__/FixJSDOMEnvironment.ts',
preset: 'ts-jest/presets/js-with-ts',
roots: [