Skip to content

Commit

Permalink
fix jest tests for updated deps
Browse files Browse the repository at this point in the history
  • Loading branch information
timkpaine committed Mar 26, 2024
1 parent 8abe8ba commit 3922107
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
17 changes: 16 additions & 1 deletion js/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,22 @@
* the Apache License 2.0. The full license can be found in the LICENSE file.
*
*/
const esModules = ["@finos", "@jupyter", "@jupyterlab", "@jupyter-widgets", "lib0", "y-protocols", "internmap", "delaunator", "robust-predicates", "lodash-es", "nanoid"].join("|");
const esModules = [
"@finos",
"@jupyter",
"@jupyterlab",
"@jupyter-widgets",
"@microsoft",
"@rjsf",
"delaunator",
"exenv-es6",
"internmap",
"lib0",
"lodash-es",
"nanoid",
"robust-predicates",
"y-protocols",
].join("|");

module.exports = {
moduleDirectories: ["node_modules", "src", "tests"],
Expand Down
14 changes: 14 additions & 0 deletions js/tests/setup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
Object.defineProperty(window, "DragEvent", {
value: class DragEvent {},
});

Object.defineProperty(window, "matchMedia", {
writable: true,
value: jest.fn().mockImplementation((query) => ({
matches: false,
media: query,
onchange: null,
addListener: jest.fn(), // Deprecated
removeListener: jest.fn(), // Deprecated
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
dispatchEvent: jest.fn(),
})),
});

0 comments on commit 3922107

Please sign in to comment.