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); +};