Skip to content

Commit

Permalink
Fix lint and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
painebot committed Jun 4, 2024
1 parent 3ee3285 commit 719319a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
1 change: 1 addition & 0 deletions js/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = {
browser: true,
es6: true,
commonjs: true,
jest: true,
},
extends: [
"eslint:recommended",
Expand Down
21 changes: 18 additions & 3 deletions js/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
/******************************************************************************
*
* Copyright (c) 2019, the jupyter-fs authors.
* Copyright (c) 2019, the nbcelltests authors.
*
* This file is part of the jupyter-fs library, distributed under the terms of
* This file is part of the nbcelltests library, distributed under the terms of
* the Apache License 2.0. The full license can be found in the LICENSE file.
*
*/
const esModules = ["@jupyter", "@jupyterlab", "@jupyter-widgets", "@lumino", "lib0", "nanoid", "y-protocols", "internmap", "delaunator", "robust-predicates", "lodash-es", "tree-finder"].join("|");
const esModules = [
"@jupyter",
"@jupyterlab",
"@jupyter-widgets",
"@lumino",
"@microsoft",
"delaunator",
"exenv-es6",
"internmap",
"lib0",
"lodash-es",
"nanoid",
"robust-predicates",
"vscode-ws-jsonrpc",
"y-protocols",
].join("|");

module.exports = {
preset: "ts-jest/presets/js-with-babel",
Expand Down
14 changes: 14 additions & 0 deletions js/tests/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,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 719319a

Please sign in to comment.