diff --git a/packages/store-engine-dexie/jest.config.js b/packages/store-engine-dexie/jest.config.js index 54deff8dd7..a781597c0f 100644 --- a/packages/store-engine-dexie/jest.config.js +++ b/packages/store-engine-dexie/jest.config.js @@ -19,20 +19,16 @@ const baseConfig = require('../../jest.config.base'); -const { TextDecoder, TextEncoder } = require('util') - +const {TextDecoder, TextEncoder} = require('util'); module.exports = { ...baseConfig, moduleNameMapper: { '^dexie$': require.resolve('dexie'), }, - setupFiles: [ - "fake-indexeddb/auto" - ], + setupFiles: ['./jest.setup.js'], globals: { TextDecoder, TextEncoder, - } + }, }; - diff --git a/packages/store-engine-dexie/jest.setup.js b/packages/store-engine-dexie/jest.setup.js new file mode 100644 index 0000000000..23b05751a1 --- /dev/null +++ b/packages/store-engine-dexie/jest.setup.js @@ -0,0 +1,21 @@ +/* + * Wire + * Copyright (C) 2024 Wire Swiss GmbH + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + * + */ + +require('core-js/stable/structured-clone'); +require('fake-indexeddb/auto'); diff --git a/packages/store-engine-dexie/package.json b/packages/store-engine-dexie/package.json index b6106f0023..7466969452 100644 --- a/packages/store-engine-dexie/package.json +++ b/packages/store-engine-dexie/package.json @@ -20,6 +20,7 @@ "@types/node": "^20.1.0", "@types/rimraf": "^3.0.2", "@wireapp/store-engine": "workspace:^", + "core-js": "^3.36.0", "fake-indexeddb": "^5.0.2", "jest": "^29.2.1", "logdown": "3.3.1", diff --git a/yarn.lock b/yarn.lock index a0b0ea584a..0df4e429cb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5510,6 +5510,7 @@ __metadata: "@types/node": ^20.1.0 "@types/rimraf": ^3.0.2 "@wireapp/store-engine": "workspace:^" + core-js: ^3.36.0 dexie: ^3.2.0 fake-indexeddb: ^5.0.2 jest: ^29.2.1 @@ -7893,6 +7894,13 @@ __metadata: languageName: node linkType: hard +"core-js@npm:^3.36.0": + version: 3.36.0 + resolution: "core-js@npm:3.36.0" + checksum: 48c807d5055ad0424f52d13583e96ddca2efcdc4e3cd9c479d60f269c8fe225191cd4e26a4593f43f7ef6dba08d161091147ecf8ae0300c15bc648a4f555217b + languageName: node + linkType: hard + "core-js@npm:^3.6.4": version: 3.26.1 resolution: "core-js@npm:3.26.1"