Skip to content

Commit

Permalink
Add requestAnimation frame shim
Browse files Browse the repository at this point in the history
React 16 depends on RAF and jsdoc doesn't provide it out of box.
shim: https://gist.github.com/paulirish/1579671
refs: jestjs/jest#1644
  • Loading branch information
RusinovAnton committed Nov 12, 2017
1 parent 805735b commit ff17e8f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ coverage/
.babelrc
.editorconfig
.eslintrc
.jestrc.js
test-setup/.jestrc.js
.sass-lint.yml
.travis.yml
rollup.config.js
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"^.+\\.(css|scss)$": "identity-obj-proxy"
},
"setupFiles": [
"./.jestrc.js"
"./test-setup/shims.js",
"./test-setup/.jestrc.js"
],
"snapshotSerializers": [
"<rootDir>/node_modules/enzyme-to-json/serializer"
Expand Down
1 change: 1 addition & 0 deletions .jestrc.js → test-setup/.jestrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Make Enzyme functions available in all test files without importing
import '../dist/react-select3.cjs'
import React from 'react'
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
Expand Down
3 changes: 3 additions & 0 deletions test-setup/shims.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
global.requestAnimationFrame = (callback) => {
setTimeout(callback, 0);
};

0 comments on commit ff17e8f

Please sign in to comment.