Skip to content

Commit 91a9f00

Browse files
committed
jest test setup
1 parent bc86894 commit 91a9f00

File tree

8 files changed

+18
-2
lines changed

8 files changed

+18
-2
lines changed

test/sample.js renamed to __tests__/sample.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
'use strict';
2+
import React from 'react';
23
import {shallow, mount} from 'enzyme';
3-
import Slider from '../src';
4+
import Slider from '../src/index';
5+
6+
47

58
describe('basic test', function() {
69
it('should add numbers', function() {

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"start": "gulp server",
88
"prepublish": "babel ./src --out-dir ./lib && gulp dist",
9-
"test": "karma start --single-run",
9+
"test": "jest",
1010
"dev-test": "karma start"
1111
},
1212
"author": "Kiran Abburi",
@@ -28,8 +28,10 @@
2828
"babel-cli": "^6.16.0",
2929
"babel-core": "^6.16.0",
3030
"babel-eslint": "^7.0.0",
31+
"babel-jest": "^15.0.0",
3132
"babel-loader": "^6.2.5",
3233
"babel-plugin-transform-object-assign": "^6.8.0",
34+
"babel-polyfill": "^6.16.0",
3335
"babel-preset-airbnb": "^2.1.1",
3436
"babel-preset-es2015": "^6.16.0",
3537
"babel-preset-react": "^6.16.0",
@@ -45,6 +47,7 @@
4547
"gulp": "^3.9.1",
4648
"gulp-sass": "^2.3.2",
4749
"jasmine-core": "^2.5.2",
50+
"jest": "^15.1.1",
4851
"json-loader": "^0.5.4",
4952
"karma": "^1.3",
5053
"karma-babel-preprocessor": "^6.0.1",
@@ -78,6 +81,9 @@
7881
"react": "^0.14.0 || ^15.0.1",
7982
"react-dom": "^0.14.0 || ^15.0.1"
8083
},
84+
"jest": {
85+
"setupFiles": ["test-setup.js"]
86+
},
8187
"npmName": "react-slick",
8288
"npmFileMap": [
8389
{
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

test-setup.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
window.matchMedia = window.matchMedia || function() {
2+
return {
3+
matches : false,
4+
addListener : function() {},
5+
removeListener: function() {}
6+
};
7+
};

0 commit comments

Comments
 (0)