Skip to content

Commit

Permalink
refactor(tests): avoid global jsdom declaration (algolia#4830)
Browse files Browse the repository at this point in the history
* refactor(tests): avoid global jsdom declaration

* chore: fix lockfile
  • Loading branch information
Haroenv authored Aug 16, 2021
1 parent 1450e85 commit d06f82c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
1 change: 0 additions & 1 deletion global.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
declare const __DEV__: boolean;
declare const jsdom: any;
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
"@types/enzyme": "^3.1.15",
"@types/jest": "^26.0.22",
"@types/jest-diff": "^24.3.0",
"@types/scriptjs": "0.0.2",
"@types/jsdom": "^16.2.13",
"@types/scriptjs": "^0.0.2",
"@types/storybook__addon-actions": "^3.4.2",
"@typescript-eslint/eslint-plugin": "4.15.1",
"@typescript-eslint/parser": "4.15.1",
Expand Down
5 changes: 3 additions & 2 deletions src/lib/__tests__/RoutingManager-test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* globals jsdom */

import qs from 'qs';
import { createSearchClient } from '../../../test/mock/createSearchClient';
import { createWidget } from '../../../test/mock/createWidget';
Expand All @@ -13,6 +11,9 @@ import {
} from '../../types';
import historyRouter from '../routers/history';
import instantsearch from '../..';
import { JSDOM } from 'jsdom';

declare const jsdom: JSDOM;

const createFakeRouter = (args: Partial<Router> = {}): Router => ({
onUpdate(..._args) {},
Expand Down
21 changes: 20 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2185,6 +2185,15 @@
jest-diff "^26.0.0"
pretty-format "^26.0.0"

"@types/jsdom@^16.2.13":
version "16.2.13"
resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-16.2.13.tgz#126c8b7441b159d6234610a48de77b6066f1823f"
integrity sha512-8JQCjdeAidptSsOcRWk2iTm9wCcwn9l+kRG6k5bzUacrnm1ezV4forq0kWjUih/tumAeoG+OspOvQEbbRucBTw==
dependencies:
"@types/node" "*"
"@types/parse5" "*"
"@types/tough-cookie" "*"

"@types/json-schema@^7.0.3":
version "7.0.3"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.3.tgz#bdfd69d61e464dcc81b25159c270d75a73c1a636"
Expand Down Expand Up @@ -2220,6 +2229,11 @@
resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==

"@types/parse5@*":
version "6.0.1"
resolved "https://registry.yarnpkg.com/@types/parse5/-/parse5-6.0.1.tgz#f8ae4fbcd2b9ba4ff934698e28778961f9cb22ca"
integrity sha512-ARATsLdrGPUnaBvxLhUlnltcMgn7pQG312S8ccdYlnyijabrX9RN/KN/iGj9Am96CoW8e/K9628BA7Bv4XHdrA==

"@types/prettier@^2.0.0":
version "2.2.3"
resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.2.3.tgz#ef65165aea2924c9359205bf748865b8881753c0"
Expand Down Expand Up @@ -2272,7 +2286,7 @@
dependencies:
"@types/node" "*"

"@types/[email protected]":
"@types/scriptjs@^0.0.2":
version "0.0.2"
resolved "https://registry.yarnpkg.com/@types/scriptjs/-/scriptjs-0.0.2.tgz#09a2287221a7a341fc6b95b005e4bfb2a5403538"
integrity sha1-CaIociGno0H8a5WwBeS/sqVANTg=
Expand Down Expand Up @@ -2301,6 +2315,11 @@
dependencies:
pretty-format "^24.3.0"

"@types/tough-cookie@*":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.1.tgz#8f80dd965ad81f3e1bc26d6f5c727e132721ff40"
integrity sha512-Y0K95ThC3esLEYD6ZuqNek29lNX2EM1qxV8y2FTLUB0ff5wWrk7az+mLrnNFUnaXcgKye22+sFBRXOgpPILZNg==

"@types/webpack-env@^1.15.0":
version "1.15.0"
resolved "https://registry.yarnpkg.com/@types/webpack-env/-/webpack-env-1.15.0.tgz#bd9956d5044b1fb43e869a9ba9148862ff98d9fd"
Expand Down

0 comments on commit d06f82c

Please sign in to comment.