From ff17e8f39fc7351afa5decb309b9a91a659d33c1 Mon Sep 17 00:00:00 2001 From: Rusinov Anton Date: Sun, 12 Nov 2017 22:11:06 +0200 Subject: [PATCH] Add requestAnimation frame shim React 16 depends on RAF and jsdoc doesn't provide it out of box. shim: https://gist.github.com/paulirish/1579671 refs: https://github.com/facebook/jest/issues/1644 --- .npmignore | 2 +- package.json | 3 ++- .jestrc.js => test-setup/.jestrc.js | 1 + test-setup/shims.js | 3 +++ 4 files changed, 7 insertions(+), 2 deletions(-) rename .jestrc.js => test-setup/.jestrc.js (97%) create mode 100644 test-setup/shims.js diff --git a/.npmignore b/.npmignore index 3b7c787..28c7bc2 100644 --- a/.npmignore +++ b/.npmignore @@ -5,7 +5,7 @@ coverage/ .babelrc .editorconfig .eslintrc -.jestrc.js +test-setup/.jestrc.js .sass-lint.yml .travis.yml rollup.config.js diff --git a/package.json b/package.json index 91db333..26f8643 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "^.+\\.(css|scss)$": "identity-obj-proxy" }, "setupFiles": [ - "./.jestrc.js" + "./test-setup/shims.js", + "./test-setup/.jestrc.js" ], "snapshotSerializers": [ "/node_modules/enzyme-to-json/serializer" diff --git a/.jestrc.js b/test-setup/.jestrc.js similarity index 97% rename from .jestrc.js rename to test-setup/.jestrc.js index 72f6c0c..150af37 100644 --- a/.jestrc.js +++ b/test-setup/.jestrc.js @@ -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'; diff --git a/test-setup/shims.js b/test-setup/shims.js new file mode 100644 index 0000000..7947f08 --- /dev/null +++ b/test-setup/shims.js @@ -0,0 +1,3 @@ +global.requestAnimationFrame = (callback) => { + setTimeout(callback, 0); +};