From a99039b2d0961fd5e0cda78ecd61137efedbbd5a Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Fri, 1 Jun 2018 10:50:25 -0700 Subject: [PATCH] Update to latest sinon --- package.json | 2 +- test/node_modules/mapbox-gl-js-test.js | 2 +- test/unit/source/source_cache.test.js | 6 +- test/unit/ui/handler/drag_pan.test.js | 2 +- test/unit/ui/handler/drag_rotate.test.js | 4 +- yarn.lock | 71 +++++++++++++++--------- 6 files changed, 53 insertions(+), 34 deletions(-) diff --git a/package.json b/package.json index e90e51aca8f..4b3ae4f6f5f 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "rollup-plugin-sourcemaps": "^0.4.2", "rollup-plugin-uglify": "^3.0.0", "rollup-plugin-unassert": "^0.2.0", - "sinon": "^2.1.0", + "sinon": "^5.0.0", "slugg": "^1.2.1", "st": "^1.2.0", "stylelint": "^8.4.0", diff --git a/test/node_modules/mapbox-gl-js-test.js b/test/node_modules/mapbox-gl-js-test.js index 0f73b871a55..f923c19f2ef 100644 --- a/test/node_modules/mapbox-gl-js-test.js +++ b/test/node_modules/mapbox-gl-js-test.js @@ -14,7 +14,7 @@ function assertEqualWithPrecision(expected, actual, multiplier, message, extra) } tap.beforeEach(function (done) { - this.sandbox = sinon.sandbox.create({ + this.sandbox = sinon.createSandbox({ injectInto: this, properties: ['spy', 'stub', 'mock'] }); diff --git a/test/unit/source/source_cache.test.js b/test/unit/source/source_cache.test.js index 7d8b36697c6..9c5cbbc0377 100644 --- a/test/unit/source/source_cache.test.js +++ b/test/unit/source/source_cache.test.js @@ -943,8 +943,8 @@ test('SourceCache#_updateRetainedTiles', (t)=> { '65' : new OverscaledTileID(1, 0, 1, 0, 1) }, 'retain ideal and parent tile when ideal tiles aren\'t loaded'); - addTileSpy.reset(); - getTileSpy.reset(); + addTileSpy.resetHistory(); + getTileSpy.resetHistory(); // now make sure we don't retain the parent tile when the ideal tile is loaded sourceCache._tiles[idealTile.key].state = 'loaded'; @@ -1116,7 +1116,7 @@ test('SourceCache#_updateRetainedTiles', (t)=> { new OverscaledTileID(0, 0, 0, 0, 0), ], 'only ascends up a tile pyramid once'); - getTileSpy.reset(); + getTileSpy.resetHistory(); const loadedTiles = [new OverscaledTileID(4, 0, 4, 0, 0)]; loadedTiles.forEach((t)=>{ diff --git a/test/unit/ui/handler/drag_pan.test.js b/test/unit/ui/handler/drag_pan.test.js index 9d5830c5c0e..aa80e373963 100644 --- a/test/unit/ui/handler/drag_pan.test.js +++ b/test/unit/ui/handler/drag_pan.test.js @@ -210,7 +210,7 @@ test('DragPanHandler requests a new render frame after each mousemove event', (t map._renderTaskQueue.run(); // https://github.com/mapbox/mapbox-gl-js/issues/6063 - requestFrame.reset(); + requestFrame.resetHistory(); simulate.mousemove(map.getCanvas(), {clientX: 20, clientY: 20}); t.equal(requestFrame.callCount, 1); diff --git a/test/unit/ui/handler/drag_rotate.test.js b/test/unit/ui/handler/drag_rotate.test.js index d19e7667069..f5e1dd599c6 100644 --- a/test/unit/ui/handler/drag_rotate.test.js +++ b/test/unit/ui/handler/drag_rotate.test.js @@ -63,7 +63,7 @@ test('DragRotateHandler stops firing events after mouseup', (t) => { simulate.mouseup(map.getCanvas(), {buttons: 0, button: 2}); t.equal(spy.callCount, 3); - spy.reset(); + spy.resetHistory(); simulate.mousemove(map.getCanvas(), {buttons: 0, clientX: 20, clientY: 20}); map._renderTaskQueue.run(); t.equal(spy.callCount, 0); @@ -419,7 +419,7 @@ test('DragRotateHandler requests a new render frame after each mousemove event', map._renderTaskQueue.run(); // https://github.com/mapbox/mapbox-gl-js/issues/6063 - requestRenderFrame.reset(); + requestRenderFrame.resetHistory(); simulate.mousemove(map.getCanvas(), {buttons: 2, clientX: 20, clientY: 20}); t.equal(requestRenderFrame.callCount, 1); diff --git a/yarn.lock b/yarn.lock index e021ae17e26..5c1fca1acc9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -235,6 +235,12 @@ version "0.7.0" resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd" +"@sinonjs/formatio@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@sinonjs/formatio/-/formatio-2.0.0.tgz#84db7e9eb5531df18a8c5e0bfb6e449e55e654b2" + dependencies: + samsam "1.3.0" + "@types/acorn@^4.0.3": version "4.0.3" resolved "https://registry.yarnpkg.com/@types/acorn/-/acorn-4.0.3.tgz#d1f3e738dde52536f9aad3d3380d14e448820afd" @@ -4236,12 +4242,6 @@ form-data@~2.3.1: combined-stream "1.0.6" mime-types "^2.1.12" -formatio@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/formatio/-/formatio-1.2.0.tgz#f3b2167d9068c4698a8d51f4f760a39a54d818eb" - dependencies: - samsam "1.x" - fragment-cache@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" @@ -5907,6 +5907,10 @@ jsx-ast-utils@^2.0.1: dependencies: array-includes "^3.0.3" +just-extend@^1.1.27: + version "1.1.27" + resolved "https://registry.yarnpkg.com/just-extend/-/just-extend-1.1.27.tgz#ec6e79410ff914e472652abfa0e603c03d60e905" + kdbush@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/kdbush/-/kdbush-1.0.1.tgz#3cbd03e9dead9c0f6f66ccdb96450e5cecc640e0" @@ -6176,6 +6180,10 @@ lodash.escape@^3.0.0: dependencies: lodash._root "^3.0.0" +lodash.get@^4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" + lodash.isarguments@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" @@ -6306,9 +6314,9 @@ log-symbols@^2.0.0: dependencies: chalk "^2.0.1" -lolex@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/lolex/-/lolex-1.6.0.tgz#3a9a0283452a47d7439e72731b9e07d7386e49f6" +lolex@^2.2.0, lolex@^2.3.2: + version "2.6.0" + resolved "https://registry.yarnpkg.com/lolex/-/lolex-2.6.0.tgz#cf9166f3c9dece3cdeb5d6b01fce50f14a1203e3" longest-streak@^2.0.1: version "2.0.2" @@ -6815,10 +6823,6 @@ nanomatch@^1.2.9: snapdragon "^0.8.1" to-regex "^3.0.1" -native-promise-only@^0.8.1: - version "0.8.1" - resolved "https://registry.yarnpkg.com/native-promise-only/-/native-promise-only-0.8.1.tgz#20a318c30cb45f71fe7adfbf7b21c99c1472ef11" - natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -6839,6 +6843,16 @@ nested-error-stacks@^2.0.0: dependencies: inherits "~2.0.1" +nise@^1.2.0: + version "1.3.3" + resolved "https://registry.yarnpkg.com/nise/-/nise-1.3.3.tgz#c17a850066a8a1dfeb37f921da02441afc4a82ba" + dependencies: + "@sinonjs/formatio" "^2.0.0" + just-extend "^1.1.27" + lolex "^2.3.2" + path-to-regexp "^1.7.0" + text-encoding "^0.6.4" + no-case@^2.2.0: version "2.3.2" resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac" @@ -8872,7 +8886,7 @@ safe-regex@^1.1.0: dependencies: ret "~0.1.10" -samsam@1.x, samsam@^1.1.3: +samsam@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/samsam/-/samsam-1.3.0.tgz#8d1d9350e25622da30de3e44ba692b5221ab7c50" @@ -9075,18 +9089,17 @@ simple-get@^2.7.0: once "^1.3.1" simple-concat "^1.0.0" -sinon@^2.1.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/sinon/-/sinon-2.4.1.tgz#021fd64b54cb77d9d2fb0d43cdedfae7629c3a36" +sinon@^5.0.0: + version "5.0.7" + resolved "https://registry.yarnpkg.com/sinon/-/sinon-5.0.7.tgz#3bded6a73613ccc9e512e20246ced69a27c27dab" dependencies: + "@sinonjs/formatio" "^2.0.0" diff "^3.1.0" - formatio "1.2.0" - lolex "^1.6.0" - native-promise-only "^0.8.1" - path-to-regexp "^1.7.0" - samsam "^1.1.3" - text-encoding "0.6.4" - type-detect "^4.0.0" + lodash.get "^4.4.2" + lolex "^2.2.0" + nise "^1.2.0" + supports-color "^5.1.0" + type-detect "^4.0.5" sitemap-static@^0.4.2: version "0.4.2" @@ -9704,6 +9717,12 @@ supports-color@^4.1.0, supports-color@^4.2.1: dependencies: has-flag "^2.0.0" +supports-color@^5.1.0: + version "5.4.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.4.0.tgz#1c6b337402c2137605efe19f10fec390f6faab54" + dependencies: + has-flag "^3.0.0" + supports-color@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.2.0.tgz#b0d5333b1184dd3666cbe5aa0b45c5ac7ac17a4a" @@ -9896,7 +9915,7 @@ test-exclude@^4.1.0, test-exclude@^4.2.0: read-pkg-up "^1.0.1" require-main-filename "^1.0.1" -text-encoding@0.6.4: +text-encoding@^0.6.4: version "0.6.4" resolved "https://registry.yarnpkg.com/text-encoding/-/text-encoding-0.6.4.tgz#e399a982257a276dae428bb92845cb71bdc26d19" @@ -10116,7 +10135,7 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" -type-detect@^4.0.0: +type-detect@^4.0.5: version "4.0.8" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"