Skip to content

Commit f29398a

Browse files
committed
Removes dependency on babel-plugin-rewire. We use sinon instead now.
1 parent e23ace2 commit f29398a

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

.babelrc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,5 @@
22
"presets": ["es2015", "stage-1", "react"],
33
"ignore": [
44
"/node_modules/"
5-
],
6-
"env": {
7-
"test": {
8-
"plugins": ["rewire"]
9-
}
10-
}
5+
]
116
}

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"babel-core": "6.14.0",
3636
"babel-eslint": "6.1.2",
3737
"babel-loader": "6.2.5",
38-
"babel-plugin-rewire": "1.0.0-rc-2",
3938
"babel-preset-es2015": "6.14.0",
4039
"babel-preset-react": "6.11.1",
4140
"babel-preset-stage-1": "6.13.0",

test/ComponentQueries.test.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,26 @@ import React from 'react';
66
import sinon from 'sinon';
77
import { expect } from 'chai';
88
import { mount } from 'enzyme';
9+
import * as SizeMe from 'react-sizeme';
910
import { describeWithDOM } from './jsdom';
1011

1112
describeWithDOM('Given the ComponentQueries library', () => {
1213
let componentQueries;
1314
let sizeMeConfig;
15+
let sinonSandbox;
1416

1517
beforeEach(() => {
16-
componentQueries = require('../src/componentQueries').default;
17-
18-
// Set up our mocks.
19-
const componentQueriesRewireAPI = componentQueries.__RewireAPI__;
18+
sinonSandbox = sinon.sandbox.create();
2019

21-
// Mock the SizeMe HOC to just return our ComponentQueries instance.
22-
componentQueriesRewireAPI.__Rewire__('sizeMe', config => {
20+
sinonSandbox.stub(SizeMe, 'default', config => {
2321
sizeMeConfig = config; return x => x;
2422
});
23+
24+
componentQueries = require('../src/componentQueries').default;
2525
});
2626

27+
afterEach(() => sinonSandbox.restore());
28+
2729
describe('When setting up the ComponentQueries HOC', () => {
2830
describe('And no queries are provided', () => {
2931
it('Then an error should be thrown', () => {
@@ -121,11 +123,6 @@ describeWithDOM('Given the ComponentQueries library', () => {
121123
});
122124

123125
describe('When rendering a component queries component', () => {
124-
let sinonSandbox;
125-
126-
beforeEach(() => { sinonSandbox = sinon.sandbox.create(); });
127-
afterEach(() => sinonSandbox.restore());
128-
129126
it('Then it should receive the appropriate props based on it\'s queries', () => {
130127
let receivedProps;
131128

0 commit comments

Comments
 (0)