Cleaned up setup/polyfills
Brian Vaughn committed
Apr 11, 2019 at 11:21 UTC
4ad85b26c0d05ed00302f415d9fbe26072bbcd6a
3 files changed
+22
-5
package.json
+1
@@ -108,6 +108,7 @@
108
"jest": "^24.7.1",
109
"lerna": "^2.8.0",
110
"lint-staged": "^7.0.5",
111
+ "local-storage-fallback": "^4.1.1",
112
"lodash.throttle": "^4.1.1",
113
"log-update": "^2.0.0",
114
"lru-cache": "^4.1.3",
src/__tests__/setupEnv.js
+9
-5
@@ -1,7 +1,11 @@
1
// @flow
2
3
-global.localStorage = {
4
- getItem: jest.fn(),
5
- setItem: jest.fn(),
6
- clear: jest.fn(),
7
-};
3
+import storage from 'local-storage-fallback';
4
+
5
+// In case async/await syntax is used in a test.
6
+import 'regenerator-runtime/runtime';
7
+
8
+// DevTools stores preferences between sessions in localStorage
9
+if (!global.hasOwnProperty('localStorage')) {
10
+ global.localStorage = storage;
11
+}
yarn.lock
+12
@@ -3284,6 +3284,11 @@ convert-source-map@^1.4.0:
3284
version "1.5.1"
3285
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5"
3286
3287
+cookie@^0.3.1:
3288
+ version "0.3.1"
3289
+ resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb"
3290
+ integrity sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=
3291
+
3292
copy-concurrently@^1.0.0:
3293
version "1.0.5"
3294
resolved "https://registry.yarnpkg.com/copy-concurrently/-/copy-concurrently-1.0.5.tgz#92297398cae34937fcafd6ec8139c18051f0b5e0"
@@ -7199,6 +7204,13 @@ loader-utils@^1.0.2, loader-utils@^1.1.0:
7204
emojis-list "^2.0.0"
7205
json5 "^1.0.1"
7206
7207
+local-storage-fallback@^4.1.1:
7208
+ version "4.1.1"
7209
+ resolved "https://registry.yarnpkg.com/local-storage-fallback/-/local-storage-fallback-4.1.1.tgz#6dc964635c8e9ab6d522d7d88538f465b62bd161"
7210
+ integrity sha512-Ka4rem1FOgvIaPMokxXTP8DgW8gjfAQSdJC8TGrplDug7vh3b0PZnY/9euG3O3cIGAvJLp33mMU6MJ13x6S+Pw==
7211
+ dependencies:
7212
+ cookie "^0.3.1"
7213
+
7214
locate-path@^2.0.0:
7215
version "2.0.0"
7216
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e"