Skip to content

Commit cda46a0

Browse files
committed
chore: make tests compatible with Jest 24
1 parent 3b23022 commit cda46a0

File tree

9 files changed

+525
-571
lines changed

9 files changed

+525
-571
lines changed

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
"packages/*"
55
],
66
"devDependencies": {
7+
"@mattiasbuelens/web-streams-polyfill": "0.1.0",
78
"art": "^0.10.1",
89
"babel-cli": "^6.6.5",
910
"babel-code-frame": "^6.26.0",
1011
"babel-core": "^6.0.0",
1112
"babel-eslint": "^10.0.0",
12-
"babel-jest": "^23.0.1",
1313
"babel-plugin-check-es2015-constants": "^6.5.0",
1414
"babel-plugin-external-helpers": "^6.22.0",
1515
"babel-plugin-syntax-trailing-function-commas": "^6.5.0",
@@ -83,8 +83,7 @@
8383
"targz": "^1.0.1",
8484
"through2": "^2.0.0",
8585
"tmp": "~0.0.28",
86-
"typescript": "~1.8.10",
87-
"@mattiasbuelens/web-streams-polyfill": "0.1.0"
86+
"typescript": "~1.8.10"
8887
},
8988
"devEngines": {
9089
"node": "8.x || 9.x || 10.x || 11.x || 12.x"

packages/eslint-plugin-react-hooks/__tests__/ESLintRuleExhaustiveDeps-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ const tests = {
521521
// Valid because the ref is captured.
522522
code: `
523523
function useMyThing(myRef) {
524-
const myRef = useRef();
524+
myRef = useRef();
525525
useEffect(() => {
526526
const handleMove = () => {};
527527
const node = myRef.current;

packages/eslint-plugin-react-hooks/__tests__/ESLintRulesOfHooks-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ eslintTester.run('react-hooks', ReactHooksESLintRule, {
9595
useHook2 = () => { useState(); };
9696
({useHook: () => { useState(); }});
9797
({useHook() { useState(); }});
98-
const {useHook = () => { useState(); }} = {};
98+
const {useHook3 = () => { useState(); }} = {};
9999
({useHook = () => { useState(); }} = {});
100100
`,
101101
`

packages/react-dom/src/__tests__/ReactDOMServerIntegrationElements-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ describe('ReactDOMServerIntegration', () => {
648648
});
649649
});
650650

651-
describe('component hierarchies', async function() {
651+
describe('component hierarchies', function() {
652652
itRenders('single child hierarchies of components', async render => {
653653
const Component = props => <div>{props.children}</div>;
654654
let e = await render(

packages/react-test-renderer/src/__tests__/ReactTestRendererAsync-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ describe('ReactTestRendererAsync', () => {
160160

161161
expect(() =>
162162
expect(Scheduler).toFlushAndYieldThrough(['foo', 'baz']),
163-
).toThrow('Expected value to equal:');
163+
).toThrow('// deep equality');
164164
});
165165

166166
it('toFlushAndYield', () => {
@@ -181,7 +181,7 @@ describe('ReactTestRendererAsync', () => {
181181
);
182182

183183
expect(() => expect(Scheduler).toFlushWithoutYielding()).toThrowError(
184-
'Expected value to equal:',
184+
'// deep equality',
185185
);
186186

187187
renderer.update(
@@ -193,7 +193,7 @@ describe('ReactTestRendererAsync', () => {
193193
);
194194

195195
expect(() => expect(Scheduler).toFlushAndYield(['foo', 'baz'])).toThrow(
196-
'Expected value to equal:',
196+
'// deep equality',
197197
);
198198
});
199199

@@ -254,7 +254,7 @@ describe('ReactTestRendererAsync', () => {
254254

255255
ReactTestRenderer.create(<App />);
256256
expect(() => expect(Scheduler).toHaveYielded(['A', 'B'])).toThrow(
257-
'Expected value to equal:',
257+
'// deep equality',
258258
);
259259
});
260260

packages/react/src/__tests__/ReactCoffeeScriptClass-test.coffee

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,3 +543,4 @@ describe 'ReactCoffeeScriptClass', ->
543543
node = ReactDOM.findDOMNode(instance)
544544
expect(node).toBe container.firstChild
545545
undefined
546+
undefined

packages/react/src/__tests__/createReactClassIntegration-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ describe('create-react-class-integration', () => {
453453
expect(() =>
454454
ReactDOM.render(<Foo foo="foo" />, document.createElement('div')),
455455
).toWarnDev(
456-
'Component: getDerivedStateFromProps() is defined as an instance method ' +
456+
'Foo: getDerivedStateFromProps() is defined as an instance method ' +
457457
'and will be ignored. Instead, declare it as a static method.',
458458
{withoutStack: true},
459459
);
@@ -471,7 +471,7 @@ describe('create-react-class-integration', () => {
471471
expect(() =>
472472
ReactDOM.render(<Foo foo="foo" />, document.createElement('div')),
473473
).toWarnDev(
474-
'Component: getDerivedStateFromError() is defined as an instance method ' +
474+
'Foo: getDerivedStateFromError() is defined as an instance method ' +
475475
'and will be ignored. Instead, declare it as a static method.',
476476
{withoutStack: true},
477477
);
@@ -491,7 +491,7 @@ describe('create-react-class-integration', () => {
491491
expect(() =>
492492
ReactDOM.render(<Foo foo="foo" />, document.createElement('div')),
493493
).toWarnDev(
494-
'Component: getSnapshotBeforeUpdate() is defined as a static method ' +
494+
'Foo: getSnapshotBeforeUpdate() is defined as a static method ' +
495495
'and will be ignored. Instead, declare it as an instance method.',
496496
{withoutStack: true},
497497
);

scripts/jest/preprocessor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ module.exports = {
7070
}
7171
: {}
7272
)
73-
).code;
73+
);
7474
}
7575
return src;
7676
},

0 commit comments

Comments
 (0)