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 Aug 7, 2019
1 parent c4f0b93 commit 4ee37e8
Show file tree
Hide file tree
Showing 9 changed files with 519 additions and 571 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"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-dynamic-import": "^6.18.0",
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 @@ -651,7 +651,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 @@ -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
1 change: 1 addition & 0 deletions scripts/jest/config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ module.exports = {
collectCoverageFrom: ['packages/**/*.js'],
timers: 'fake',
snapshotSerializers: [require.resolve('jest-snapshot-serializer-raw')],
testURL: 'about:blank',
};
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 4ee37e8

Please sign in to comment.