Skip to content

Commit

Permalink
chore: make tests compatible with Jest 24
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed May 30, 2019
1 parent 3b23022 commit cda46a0
Show file tree
Hide file tree
Showing 9 changed files with 525 additions and 571 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"packages/*"
],
"devDependencies": {
"@mattiasbuelens/web-streams-polyfill": "0.1.0",
"art": "^0.10.1",
"babel-cli": "^6.6.5",
"babel-code-frame": "^6.26.0",
"babel-core": "^6.0.0",
"babel-eslint": "^10.0.0",
"babel-jest": "^23.0.1",
"babel-plugin-check-es2015-constants": "^6.5.0",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-syntax-trailing-function-commas": "^6.5.0",
Expand Down Expand Up @@ -83,8 +83,7 @@
"targz": "^1.0.1",
"through2": "^2.0.0",
"tmp": "~0.0.28",
"typescript": "~1.8.10",
"@mattiasbuelens/web-streams-polyfill": "0.1.0"
"typescript": "~1.8.10"
},
"devEngines": {
"node": "8.x || 9.x || 10.x || 11.x || 12.x"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ const tests = {
// Valid because the ref is captured.
code: `
function useMyThing(myRef) {
const myRef = useRef();
myRef = useRef();
useEffect(() => {
const handleMove = () => {};
const node = myRef.current;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ eslintTester.run('react-hooks', ReactHooksESLintRule, {
useHook2 = () => { useState(); };
({useHook: () => { useState(); }});
({useHook() { useState(); }});
const {useHook = () => { useState(); }} = {};
const {useHook3 = () => { useState(); }} = {};
({useHook = () => { useState(); }} = {});
`,
`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ describe('ReactDOMServerIntegration', () => {
});
});

describe('component hierarchies', async function() {
describe('component hierarchies', function() {
itRenders('single child hierarchies of components', async render => {
const Component = props => <div>{props.children}</div>;
let e = await render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ describe('ReactTestRendererAsync', () => {

expect(() =>
expect(Scheduler).toFlushAndYieldThrough(['foo', 'baz']),
).toThrow('Expected value to equal:');
).toThrow('// deep equality');
});

it('toFlushAndYield', () => {
Expand All @@ -181,7 +181,7 @@ describe('ReactTestRendererAsync', () => {
);

expect(() => expect(Scheduler).toFlushWithoutYielding()).toThrowError(
'Expected value to equal:',
'// deep equality',
);

renderer.update(
Expand All @@ -193,7 +193,7 @@ describe('ReactTestRendererAsync', () => {
);

expect(() => expect(Scheduler).toFlushAndYield(['foo', 'baz'])).toThrow(
'Expected value to equal:',
'// deep equality',
);
});

Expand Down Expand Up @@ -254,7 +254,7 @@ describe('ReactTestRendererAsync', () => {

ReactTestRenderer.create(<App />);
expect(() => expect(Scheduler).toHaveYielded(['A', 'B'])).toThrow(
'Expected value to equal:',
'// deep equality',
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,3 +543,4 @@ describe 'ReactCoffeeScriptClass', ->
node = ReactDOM.findDOMNode(instance)
expect(node).toBe container.firstChild
undefined
undefined
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ describe('create-react-class-integration', () => {
expect(() =>
ReactDOM.render(<Foo foo="foo" />, document.createElement('div')),
).toWarnDev(
'Component: getDerivedStateFromProps() is defined as an instance method ' +
'Foo: getDerivedStateFromProps() is defined as an instance method ' +
'and will be ignored. Instead, declare it as a static method.',
{withoutStack: true},
);
Expand All @@ -471,7 +471,7 @@ describe('create-react-class-integration', () => {
expect(() =>
ReactDOM.render(<Foo foo="foo" />, document.createElement('div')),
).toWarnDev(
'Component: getDerivedStateFromError() is defined as an instance method ' +
'Foo: getDerivedStateFromError() is defined as an instance method ' +
'and will be ignored. Instead, declare it as a static method.',
{withoutStack: true},
);
Expand All @@ -491,7 +491,7 @@ describe('create-react-class-integration', () => {
expect(() =>
ReactDOM.render(<Foo foo="foo" />, document.createElement('div')),
).toWarnDev(
'Component: getSnapshotBeforeUpdate() is defined as a static method ' +
'Foo: getSnapshotBeforeUpdate() is defined as a static method ' +
'and will be ignored. Instead, declare it as an instance method.',
{withoutStack: true},
);
Expand Down
2 changes: 1 addition & 1 deletion scripts/jest/preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ module.exports = {
}
: {}
)
).code;
);
}
return src;
},
Expand Down
Loading

0 comments on commit cda46a0

Please sign in to comment.