diff --git a/__tests__/index.js b/__tests__/index.js index 20f448c..a4120fe 100644 --- a/__tests__/index.js +++ b/__tests__/index.js @@ -9,7 +9,8 @@ describe('storage', () => // clear // https://html.spec.whatwg.org/multipage/webstorage.html#dom-storage-clear test('storage.clear', () => { - const KEY = 'foo', VALUE = 'bar'; + const KEY = 'foo', + VALUE = 'bar'; storage.setItem(KEY, VALUE); expect(storage.setItem).toHaveBeenLastCalledWith(KEY, VALUE); expect(storage.__STORE__[KEY]).toBe(VALUE); @@ -29,7 +30,9 @@ describe('storage', () => // setItem // https://html.spec.whatwg.org/multipage/webstorage.html#dom-storage-setitem test('storage.setItem', () => { - const KEY = 'foo', VALUE1 = 'bar', VALUE2 = 'baz'; + const KEY = 'foo', + VALUE1 = 'bar', + VALUE2 = 'baz'; storage.setItem(KEY, VALUE1); expect(storage.setItem).toHaveBeenLastCalledWith(KEY, VALUE1); expect(storage.__STORE__[KEY]).toBe(VALUE1); @@ -85,7 +88,9 @@ describe('storage', () => // https://html.spec.whatwg.org/multipage/webstorage.html#dom-storage-length // length is not mocked test('storage set and remove', () => { - const KEY1 = 'foo', VALUE = 'bar', KEY2 = 'baz'; + const KEY1 = 'foo', + VALUE = 'bar', + KEY2 = 'baz'; expect(storage.length).toBe(0); storage.setItem(KEY1, VALUE); expect(storage.setItem).toHaveBeenLastCalledWith(KEY1, VALUE); @@ -103,7 +108,8 @@ describe('storage', () => // key // https://html.spec.whatwg.org/multipage/webstorage.html#dom-storage-key test('storage.key', () => { - const KEY = 'foo', VALUE = 'bar'; + const KEY = 'foo', + VALUE = 'bar'; storage.setItem(KEY, VALUE); expect(storage.getItem(KEY)).toBe(VALUE); expect(storage.key(0)).toBe(KEY); diff --git a/package.json b/package.json index 8f54439..1ed2185 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jest-localstorage-mock", - "version": "1.2.0", + "version": "2.0.0", "description": "Mock localstorage in your Jest tests", "main": "dist/setup.js", "module": "src/setup.js", diff --git a/rollup.config.js b/rollup.config.js index cdb1b44..4365792 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -3,7 +3,6 @@ import babel from 'rollup-plugin-babel'; export default { input: 'src/setup.js', - format: 'cjs', plugins: [ resolve(), babel({ @@ -16,6 +15,6 @@ export default { output: { file: 'dist/setup.js', format: 'cjs', - sourcemap: true - } + sourcemap: true, + }, }; diff --git a/yarn.lock b/yarn.lock index c58a5fb..bb6bd76 100644 --- a/yarn.lock +++ b/yarn.lock @@ -86,12 +86,6 @@ ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" -ansi-styles@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.0.0.tgz#5404e93a544c4fec7f048262977bebfe3155e0c1" - dependencies: - color-convert "^1.0.0" - ansi-styles@^3.1.0, ansi-styles@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" @@ -172,10 +166,6 @@ assert-plus@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" -ast-types@0.9.8: - version "0.9.8" - resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.8.tgz#6cb6a40beba31f49f20928e28439fc14a3dab078" - astral-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" @@ -202,7 +192,7 @@ aws4@^1.2.1: version "1.6.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" -babel-code-frame@6.22.0, babel-code-frame@^6.22.0: +babel-code-frame@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" dependencies: @@ -595,8 +585,8 @@ babel-plugin-transform-strict-mode@^6.24.1: babel-types "^6.24.1" babel-preset-env@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/babel-preset-env/-/babel-preset-env-1.4.0.tgz#c8e02a3bcc7792f23cded68e0355b9d4c28f0f7a" + version "1.6.0" + resolved "https://registry.yarnpkg.com/babel-preset-env/-/babel-preset-env-1.6.0.tgz#2de1c782a780a0a5d605d199c957596da43c44e4" dependencies: babel-plugin-check-es2015-constants "^6.22.0" babel-plugin-syntax-trailing-function-commas "^6.22.0" @@ -625,8 +615,9 @@ babel-preset-env@^1.4.0: babel-plugin-transform-es2015-unicode-regex "^6.22.0" babel-plugin-transform-exponentiation-operator "^6.22.0" babel-plugin-transform-regenerator "^6.22.0" - browserslist "^1.4.0" + browserslist "^2.1.2" invariant "^2.2.2" + semver "^5.3.0" babel-preset-jest@^21.0.2: version "21.0.2" @@ -686,10 +677,6 @@ babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.24.1: lodash "^4.2.0" to-fast-properties "^1.0.1" -babylon@7.0.0-beta.8: - version "7.0.0-beta.8" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.8.tgz#2bdc5ae366041442c27e068cce6f0d7c06ea9949" - babylon@^6.11.0, babylon@^6.13.0, babylon@^6.15.0: version "6.17.0" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.0.tgz#37da948878488b9c4e3c4038893fa3314b3fc932" @@ -748,12 +735,12 @@ browser-resolve@^1.11.0, browser-resolve@^1.11.2: dependencies: resolve "1.1.7" -browserslist@^1.4.0: - version "1.7.7" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-1.7.7.tgz#0bd76704258be829b2398bb50e4b62d1a166b0b9" +browserslist@^2.1.2: + version "2.4.0" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-2.4.0.tgz#693ee93d01e66468a6348da5498e011f578f87f8" dependencies: - caniuse-db "^1.0.30000639" - electron-to-chromium "^1.2.7" + caniuse-lite "^1.0.30000718" + electron-to-chromium "^1.3.18" bser@^2.0.0: version "2.0.0" @@ -791,9 +778,9 @@ camelcase@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" -caniuse-db@^1.0.30000639: - version "1.0.30000665" - resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000665.tgz#e84f4277935f295f546f8533cb0b410a8415b972" +caniuse-lite@^1.0.30000718: + version "1.0.30000731" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000731.tgz#6f2b9096285af3c7bcf2abe39647bb525d68c842" caseless@~0.12.0: version "0.12.0" @@ -806,7 +793,7 @@ center-align@^0.1.1: align-text "^0.1.3" lazy-cache "^1.0.3" -chalk@1.1.3, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: +chalk@^1.1.0, chalk@^1.1.1: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" dependencies: @@ -866,7 +853,7 @@ code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" -color-convert@^1.0.0, color-convert@^1.9.0: +color-convert@^1.9.0: version "1.9.0" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a" dependencies: @@ -1032,9 +1019,9 @@ ecc-jsbn@~0.1.1: dependencies: jsbn "~0.1.0" -electron-to-chromium@^1.2.7: - version "1.3.9" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.9.tgz#db1cba2a26aebcca2f7f5b8b034554468609157d" +electron-to-chromium@^1.3.18: + version "1.3.21" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.21.tgz#a967ebdcfe8ed0083fc244d1894022a8e8113ea2" "errno@>=0.1.1 <0.2.0-0": version "0.1.4" @@ -1082,16 +1069,17 @@ escodegen@^1.6.1: source-map "~0.2.0" eslint-config-prettier@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-2.0.0.tgz#073cdb2760c0ba817c9b3fbf2300110a77a35626" + version "2.5.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-2.5.0.tgz#9ecb9296bae4e2e59a3ce361a96c9f825fe67b75" dependencies: get-stdin "^5.0.1" eslint-plugin-prettier@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.0.1.tgz#2ae1216cf053dd728360ca8560bf1aabc8af3fa9" + version "2.2.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.2.0.tgz#f2837ad063903d73c621e7188fb3d41486434088" dependencies: - requireindex "~1.1.0" + fast-diff "^1.1.1" + jest-docblock "^20.0.1" eslint-scope@^3.7.1: version "3.7.1" @@ -1190,7 +1178,7 @@ estree-walker@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.2.1.tgz#bdafe8095383d8414d5dc2ecf4c9173b6db9412e" -esutils@2.0.2, esutils@^2.0.2: +esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" @@ -1261,6 +1249,10 @@ fast-deep-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" +fast-diff@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.1.tgz#0aea0e4e605b6a2189f0e936d4b7fbaf1b7cfd9b" + fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" @@ -1327,10 +1319,6 @@ flat-cache@^1.2.1: graceful-fs "^4.1.2" write "^0.2.1" -flow-parser@0.45.0: - version "0.45.0" - resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.45.0.tgz#aa29d4ae27f06aa02817772bba0fcbefef7e62f0" - for-each@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.2.tgz#2c40450b9348e97f281322593ba96704b9abd4d4" @@ -1416,7 +1404,7 @@ get-caller-file@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5" -get-stdin@5.0.1, get-stdin@^5.0.1: +get-stdin@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-5.0.1.tgz#122e161591e21ff4c52530305693f20e6393a398" @@ -1443,7 +1431,7 @@ glob-parent@^2.0.0: dependencies: is-glob "^2.0.0" -glob@7.1.1, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1: +glob@^7.0.3, glob@^7.0.5, glob@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" dependencies: @@ -1919,6 +1907,10 @@ jest-diff@^21.1.0: jest-get-type "^21.0.2" pretty-format "^21.1.0" +jest-docblock@^20.0.1: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-20.0.3.tgz#17bea984342cc33d83c50fbe1545ea0efaa44712" + jest-docblock@^21.1.0: version "21.1.0" resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.1.0.tgz#43154be2441fb91403e36bb35cb791a5017cea81" @@ -1966,13 +1958,6 @@ jest-jasmine2@^21.1.0: jest-snapshot "^21.1.0" p-cancelable "^0.3.0" -jest-matcher-utils@^19.0.0: - version "19.0.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-19.0.0.tgz#5ecd9b63565d2b001f61fbf7ec4c7f537964564d" - dependencies: - chalk "^1.1.3" - pretty-format "^19.0.0" - jest-matcher-utils@^21.1.0: version "21.1.0" resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-21.1.0.tgz#b02e237b287c58915ce9a5bf3c7138dba95125a7" @@ -2071,15 +2056,6 @@ jest-util@^21.1.0: jest-validate "^21.1.0" mkdirp "^0.5.1" -jest-validate@19.0.0: - version "19.0.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-19.0.0.tgz#8c6318a20ecfeaba0ba5378bfbb8277abded4173" - dependencies: - chalk "^1.1.1" - jest-matcher-utils "^19.0.0" - leven "^2.0.0" - pretty-format "^19.0.0" - jest-validate@^21.1.0: version "21.1.0" resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-21.1.0.tgz#39d01115544a758bce49f221a5fcbb24ebdecc65" @@ -2210,7 +2186,7 @@ lcid@^1.0.0: dependencies: invert-kv "^1.0.0" -leven@^2.0.0, leven@^2.1.0: +leven@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" @@ -2332,7 +2308,7 @@ minimist@0.0.8, minimist@~0.0.1: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" -minimist@1.2.0, minimist@^1.1.1, minimist@^1.2.0, minimist@~1.2.0: +minimist@^1.1.1, minimist@^1.2.0, minimist@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" @@ -2623,25 +2599,8 @@ preserve@^0.2.0: resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" prettier@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.3.1.tgz#fa0ea84b45ac0ba6de6a1e4cecdcff900d563151" - dependencies: - ast-types "0.9.8" - babel-code-frame "6.22.0" - babylon "7.0.0-beta.8" - chalk "1.1.3" - esutils "2.0.2" - flow-parser "0.45.0" - get-stdin "5.0.1" - glob "7.1.1" - jest-validate "19.0.0" - minimist "1.2.0" - -pretty-format@^19.0.0: - version "19.0.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-19.0.0.tgz#56530d32acb98a3fa4851c4e2b9d37b420684c84" - dependencies: - ansi-styles "^3.0.0" + version "1.7.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.7.0.tgz#47481588f41f7c90f63938feb202ac82554e7150" pretty-format@^21.1.0: version "21.1.0" @@ -2849,10 +2808,6 @@ require-uncached@^1.0.3: caller-path "^0.1.0" resolve-from "^1.0.0" -requireindex@~1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/requireindex/-/requireindex-1.1.0.tgz#e5404b81557ef75db6e49c5a72004893fe03e162" - resolve-from@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226"