Skip to content

Commit

Permalink
[6.x] Upgrade sinon (v1.17.3 --> v5.0.7). (#19293)
Browse files Browse the repository at this point in the history
  • Loading branch information
azasypkin authored May 22, 2018
1 parent 8bd8d4c commit dc16506
Show file tree
Hide file tree
Showing 112 changed files with 444 additions and 354 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
"prettier": "^1.12.1",
"proxyquire": "1.7.11",
"simple-git": "1.37.0",
"sinon": "1.17.3",
"sinon": "^5.0.7",
"source-map": "0.5.6",
"source-map-support": "0.2.10",
"strip-ansi": "^3.0.1",
Expand Down
8 changes: 4 additions & 4 deletions packages/kbn-datemath/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,8 @@ describe('dateMath', function() {
dateMath.parse('now', { momentInstance: m1 });
expect(m1Spy.called).to.be(true);
expect(m2Spy.called).to.be(false);
m1Spy.reset();
m2Spy.reset();
m1Spy.resetHistory();
m2Spy.resetHistory();
dateMath.parse('now', { momentInstance: m2 });
expect(m1Spy.called).to.be(false);
expect(m2Spy.called).to.be(true);
Expand All @@ -371,8 +371,8 @@ describe('dateMath', function() {
dateMath.parse('now', { momentInstance: m });
expect(momentSpy.called).to.be(false);
expect(cloneSpy.called).to.be(true);
momentSpy.reset();
cloneSpy.reset();
momentSpy.resetHistory();
cloneSpy.resetHistory();
dateMath.parse('now');
expect(momentSpy.called).to.be(true);
expect(cloneSpy.called).to.be(false);
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-ui-framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"redux": "3.7.2",
"redux-thunk": "2.2.0",
"sass-loader": "6.0.6",
"sinon": "1.17.2",
"sinon": "^5.0.7",
"style-loader": "0.19.0",
"webpack": "3.6.0",
"webpack-dev-server": "2.9.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
KuiToolBarSearchBox,
} from './tool_bar_search_box';

const onFilter = sinon.spy();
const onFilter = sinon.stub();

test('renders KuiToolBarSearchBox', () => {
const component = <KuiToolBarSearchBox onFilter={onFilter} {...requiredProps} />;
Expand All @@ -17,7 +17,7 @@ test('renders KuiToolBarSearchBox', () => {
describe('onFilter', () => {
test('is called on change event, with the value entered', () => {
const searchBox = mount(<KuiToolBarSearchBox onFilter={onFilter} {...requiredProps} />);
onFilter.reset();
onFilter.resetHistory();
const event = { target: { value: 'a' } };
searchBox.find('input').simulate('change', event);
sinon.assert.calledWith(onFilter, 'a');
Expand Down
77 changes: 52 additions & 25 deletions packages/kbn-ui-framework/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
version "0.0.0"
uid ""

"@sinonjs/formatio@^2.0.0":
version "2.0.0"
resolved "http://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz#84db7e9eb5531df18a8c5e0bfb6e449e55e654b2"
dependencies:
samsam "1.3.0"

"@zeit/check-updates@1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@zeit/check-updates/-/check-updates-1.1.0.tgz#d0f65026a36f27cd1fd54c647d8294447c1d2d8b"
Expand Down Expand Up @@ -2085,7 +2091,7 @@ diff@^2.1.2:
version "2.2.3"
resolved "https://registry.yarnpkg.com/diff/-/diff-2.2.3.tgz#60eafd0d28ee906e4e8ff0a52c1229521033bf99"

diff@^3.3.1:
diff@^3.1.0, diff@^3.3.1:
version "3.5.0"
resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12"

Expand Down Expand Up @@ -2773,12 +2779,6 @@ form-data@~2.3.1:
combined-stream "1.0.6"
mime-types "^2.1.12"

formatio@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/formatio/-/formatio-1.1.1.tgz#5ed3ccd636551097383465d996199100e86161e9"
dependencies:
samsam "~1.1"

forwarded@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84"
Expand Down Expand Up @@ -4027,6 +4027,10 @@ jsprim@^1.2.2:
json-schema "0.2.3"
verror "1.10.0"

just-extend@^1.1.27:
version "1.1.27"
resolved "https://registry.yarnpkg.com/just-extend/-/just-extend-1.1.27.tgz#ec6e79410ff914e472652abfa0e603c03d60e905"

keymirror@0.1.1, keymirror@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/keymirror/-/keymirror-0.1.1.tgz#918889ea13f8d0a42e7c557250eee713adc95c35"
Expand Down Expand Up @@ -4215,9 +4219,9 @@ loglevel@^1.4.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.1.tgz#e0fc95133b6ef276cdc8887cdaf24aa6f156f8fa"

lolex@1.3.2:
version "1.3.2"
resolved "https://registry.yarnpkg.com/lolex/-/lolex-1.3.2.tgz#7c3da62ffcb30f0f5a80a2566ca24e45d8a01f31"
lolex@^2.2.0, lolex@^2.3.2:
version "2.5.0"
resolved "https://registry.yarnpkg.com/lolex/-/lolex-2.5.0.tgz#69d6a667607738564daf108f63240ae8cbd28fb4"

longest@^1.0.1:
version "1.0.1"
Expand Down Expand Up @@ -4562,6 +4566,16 @@ neo-async@^2.5.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.5.0.tgz#76b1c823130cca26acfbaccc8fbaf0a2fa33b18f"

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"
Expand Down Expand Up @@ -6089,13 +6103,9 @@ safe-regex@^1.1.0:
dependencies:
ret "~0.1.10"

samsam@1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/samsam/-/samsam-1.1.2.tgz#bec11fdc83a9fda063401210e40176c3024d1567"

samsam@~1.1:
version "1.1.3"
resolved "https://registry.yarnpkg.com/samsam/-/samsam-1.1.3.tgz#9f5087419b4d091f232571e7fa52e90b0f552621"
samsam@1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/samsam/-/samsam-1.3.0.tgz#8d1d9350e25622da30de3e44ba692b5221ab7c50"

sass-graph@^2.1.1:
version "2.2.4"
Expand Down Expand Up @@ -6341,14 +6351,17 @@ signal-exit@^3.0.0, signal-exit@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"

sinon@1.17.2:
version "1.17.2"
resolved "https://registry.yarnpkg.com/sinon/-/sinon-1.17.2.tgz#c1ea67b84a1e7b3350f6c4713efacef8e4ae8b71"
sinon@^5.0.7:
version "5.0.7"
resolved "https://registry.yarnpkg.com/sinon/-/sinon-5.0.7.tgz#3bded6a73613ccc9e512e20246ced69a27c27dab"
dependencies:
formatio "1.1.1"
lolex "1.3.2"
samsam "1.1.2"
util ">=0.10.3 <1"
"@sinonjs/formatio" "^2.0.0"
diff "^3.1.0"
lodash.get "^4.4.2"
lolex "^2.2.0"
nise "^1.2.0"
supports-color "^5.1.0"
type-detect "^4.0.5"

slash@^1.0.0:
version "1.0.0"
Expand Down Expand Up @@ -6709,6 +6722,12 @@ supports-color@^4.0.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, supports-color@^5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.3.0.tgz#5b24ac15db80fa927cf5227a4a33fd3c4c7676c0"
Expand Down Expand Up @@ -6788,6 +6807,10 @@ term-size@^1.2.0:
dependencies:
execa "^0.7.0"

text-encoding@^0.6.4:
version "0.6.4"
resolved "https://registry.yarnpkg.com/text-encoding/-/text-encoding-0.6.4.tgz#e399a982257a276dae428bb92845cb71bdc26d19"

text-table@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
Expand Down Expand Up @@ -6918,6 +6941,10 @@ twig@^0.8.2:
minimatch "3.0.x"
walk "2.3.x"

type-detect@^4.0.5:
version "4.0.8"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"

type-is@~1.6.15:
version "1.6.16"
resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.16.tgz#f89ce341541c672b25ee7ae3c73dee3b2be50194"
Expand Down Expand Up @@ -7109,7 +7136,7 @@ util-deprecate@^1.0.2, util-deprecate@~1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"

util@0.10.3, "util@>=0.10.3 <1", util@^0.10.3:
util@0.10.3, util@^0.10.3:
version "0.10.3"
resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9"
dependencies:
Expand Down
4 changes: 2 additions & 2 deletions src/cli/cluster/cluster_manager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import ClusterManager from './cluster_manager';
import Worker from './worker';

describe('CLI cluster manager', function () {
const sandbox = sinon.sandbox.create();
const sandbox = sinon.createSandbox();

beforeEach(function () {
sandbox.stub(cluster, 'fork', function () {
sandbox.stub(cluster, 'fork').callsFake(() => {
return {
process: {
kill: sinon.stub(),
Expand Down
4 changes: 2 additions & 2 deletions src/cli/cluster/worker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ function setup(opts = {}) {
}

describe('CLI cluster manager', function () {
const sandbox = sinon.sandbox.create();
const sandbox = sinon.createSandbox();

beforeEach(function () {
sandbox.stub(cluster, 'fork', () => new MockClusterFork());
sandbox.stub(cluster, 'fork').callsFake(() => new MockClusterFork());
});

afterEach(async function () {
Expand Down
2 changes: 1 addition & 1 deletion src/cli_keystore/add.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as prompt from '../server/utils/prompt';

describe('Kibana keystore', () => {
describe('add', () => {
const sandbox = sinon.sandbox.create();
const sandbox = sinon.createSandbox();

const keystoreData = '1:IxR0geiUTMJp8ueHDkqeUJ0I9eEw4NJPXIJi22UDyfGfJSy4mH'
+ 'BBuGPkkAix/x/YFfIxo4tiKGdJ2oVTtU8LgKDkVoGdL+z7ylY4n3myatt6osqhI4lzJ9M'
Expand Down
2 changes: 1 addition & 1 deletion src/cli_keystore/create.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as prompt from '../server/utils/prompt';

describe('Kibana keystore', () => {
describe('create', () => {
const sandbox = sinon.sandbox.create();
const sandbox = sinon.createSandbox();

const keystoreData = '1:IxR0geiUTMJp8ueHDkqeUJ0I9eEw4NJPXIJi22UDyfGfJSy4mH'
+ 'BBuGPkkAix/x/YFfIxo4tiKGdJ2oVTtU8LgKDkVoGdL+z7ylY4n3myatt6osqhI4lzJ9M'
Expand Down
2 changes: 1 addition & 1 deletion src/cli_keystore/list.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Logger from '../cli_plugin/lib/logger';

describe('Kibana keystore', () => {
describe('list', () => {
const sandbox = sinon.sandbox.create();
const sandbox = sinon.createSandbox();

const keystoreData = '1:IxR0geiUTMJp8ueHDkqeUJ0I9eEw4NJPXIJi22UDyfGfJSy4mH'
+ 'BBuGPkkAix/x/YFfIxo4tiKGdJ2oVTtU8LgKDkVoGdL+z7ylY4n3myatt6osqhI4lzJ9M'
Expand Down
2 changes: 1 addition & 1 deletion src/cli_keystore/remove.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { remove } from './remove';

describe('Kibana keystore', () => {
describe('remove', () => {
const sandbox = sinon.sandbox.create();
const sandbox = sinon.createSandbox();

const keystoreData = '1:IxR0geiUTMJp8ueHDkqeUJ0I9eEw4NJPXIJi22UDyfGfJSy4mH'
+ 'BBuGPkkAix/x/YFfIxo4tiKGdJ2oVTtU8LgKDkVoGdL+z7ylY4n3myatt6osqhI4lzJ9M'
Expand Down
15 changes: 4 additions & 11 deletions src/cli_plugin/install/cleanup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('kibana cli', function () {

it('should resolve if the working path does not exist', function () {
sinon.stub(rimraf, 'sync');
sinon.stub(fs, 'statSync', function () {
sinon.stub(fs, 'statSync').callsFake(() => {
const error = new Error('ENOENT');
error.code = 'ENOENT';
throw error;
Expand All @@ -49,10 +49,7 @@ describe('kibana cli', function () {

it('should rethrow any exception except ENOENT from fs.statSync', function () {
sinon.stub(rimraf, 'sync');
sinon.stub(fs, 'statSync', function () {
const error = new Error('An Unhandled Error');
throw error;
});
sinon.stub(fs, 'statSync').throws(new Error('An Unhandled Error'));

errorStub = sinon.stub();
return cleanPrevious(settings, logger)
Expand All @@ -75,9 +72,7 @@ describe('kibana cli', function () {

it('should rethrow any exception from rimraf.sync', function () {
sinon.stub(fs, 'statSync');
sinon.stub(rimraf, 'sync', function () {
throw new Error('I am an error thrown by rimraf');
});
sinon.stub(rimraf, 'sync').throws(new Error('I am an error thrown by rimraf'));

errorStub = sinon.stub();
return cleanPrevious(settings, logger)
Expand Down Expand Up @@ -114,9 +109,7 @@ describe('kibana cli', function () {
});

it('should swallow any errors thrown by rimraf.sync', function () {
sinon.stub(rimraf, 'sync', function () {
throw new Error('Something bad happened.');
});
sinon.stub(rimraf, 'sync').throws(new Error('Something bad happened.'));

expect(() => cleanArtifacts(settings)).not.toThrow();
});
Expand Down
6 changes: 3 additions & 3 deletions src/cli_plugin/install/rename.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('plugin folder rename', function () {
});

it('should rethrow any exceptions', function () {
renameStub = sinon.stub(fs, 'rename', function (from, to, cb) {
renameStub = sinon.stub(fs, 'rename').callsFake((from, to, cb) => {
cb({
code: 'error'
});
Expand All @@ -29,7 +29,7 @@ describe('plugin folder rename', function () {
});

it('should resolve if there are no errors', function () {
renameStub = sinon.stub(fs, 'rename', function (from, to, cb) {
renameStub = sinon.stub(fs, 'rename').callsFake((from, to, cb) => {
cb();
});

Expand All @@ -55,7 +55,7 @@ describe('plugin folder rename', function () {
});

it('should retry on Windows EPERM errors for up to 3 seconds', function () {
renameStub = sinon.stub(fs, 'rename', function (from, to, cb) {
renameStub = sinon.stub(fs, 'rename').callsFake((from, to, cb) => {
cb({
code: 'EPERM'
});
Expand Down
4 changes: 1 addition & 3 deletions src/core_plugins/console/server/__tests__/proxy_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ const parsedLocalEs = parseUrl('https://localhost:5601/search');

describe('ProxyConfig', function () {
beforeEach(function () {
sinon.stub(fs, 'readFileSync', function (path) {
return { path };
});
sinon.stub(fs, 'readFileSync').callsFake((path) => ({ path }));
});

afterEach(function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ProxyConfigCollection } from '../proxy_config_collection';

describe('ProxyConfigCollection', function () {
beforeEach(function () {
sinon.stub(fs, 'readFileSync', () => new Buffer(0));
sinon.stub(fs, 'readFileSync').callsFake(() => new Buffer(0));
});

afterEach(function () {
Expand Down
6 changes: 3 additions & 3 deletions src/core_plugins/console/server/__tests__/proxy_route/body.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ import { createProxyRoute } from '../../';
import { createWreckResponseStub } from './stubs';

describe('Console Proxy Route', () => {
const sandbox = sinon.sandbox.create();
const sandbox = sinon.createSandbox();
const teardowns = [];
let request;

beforeEach(() => {
teardowns.push(() => sandbox.restore());
request = async (method, path, response) => {
sandbox.stub(Wreck, 'request', createWreckResponseStub(response));
sandbox.stub(Wreck, 'request').callsFake(createWreckResponseStub(response));

const server = new Server();

Expand All @@ -37,6 +36,7 @@ describe('Console Proxy Route', () => {
});

afterEach(async () => {
sandbox.restore();
await Promise.all(teardowns.splice(0).map(fn => fn()));
});

Expand Down
Loading

0 comments on commit dc16506

Please sign in to comment.