Skip to content

Commit

Permalink
Merge pull request #11 from kiwicom/testing-env
Browse files Browse the repository at this point in the history
Improve testing environment for whole repo
  • Loading branch information
jakubzaba authored Feb 22, 2018
2 parents dd6f961 + 2bcd53a commit a1eda68
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 18 deletions.
30 changes: 30 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build: # blkn
docker:
- image: circleci/node:8

working_directory: ~/react-kiwi-ui

steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "yarn.lock" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: yarn

- save_cache:
key: v1-dependencies-{{ checksum "yarn.lock" }}
paths:
- node_modules

- run: yarn test-ci
22 changes: 21 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"env": {
"jest": true
},
"root": true,
"parser": "babel-eslint",
"extends": [
"airbnb",
Expand All @@ -9,10 +13,26 @@
],
"plugins": [
"flowtype",
"prettier"
"prettier",
"jest"
],
"rules": {
"prettier/prettier": "error",
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": [
"**/*.test.js",
"**/*.spec.js",
"**/*.stories.js",
"**/stories/**",
"/config/**"
]
}
],
"react/require-default-props": "off", // Optional props can be undefined.
"react/jsx-filename-extension": ["error", { "extensions": [".js"] }], // Don't use jsx
"jsx-a11y/label-has-for": "off", // control is wrapped in a label
"jsx-a11y/href-no-hash": "off" // broken rule
}
}
2 changes: 2 additions & 0 deletions blkn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
"styled-jsx": "^2.2.4"
},
"devDependencies": {
"@storybook/addon-actions": "^3.3.14",
"@storybook/react": "^3.3.13",
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"enzyme": "^3.3.0",
"eslint": "^4.17.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-prettier": "^2.6.0",
Expand Down
4 changes: 2 additions & 2 deletions blkn/src/Input/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import * as React from "react";
import Typography from "./../Typography";

type Props = {
label?: string,
error?: string,
value: string,
onChange: (SyntheticInputEvent<HTMLInputElement>) => any,
label?: string,
error?: string,
};

const Input = (props: Props) => (
Expand Down
4 changes: 2 additions & 2 deletions blkn/src/Typography/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ const Typography = (props: Props) => (
);

Typography.defaultProps = {
size: "normal",
type: "primary",
size: "normal", // eslint-disable-line react/default-props-match-prop-types
type: "primary", // eslint-disable-line react/default-props-match-prop-types
};

export default Typography;
File renamed without changes.
7 changes: 7 additions & 0 deletions jest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"setupFiles": [
"raf/polyfill",
"./config/enzymeConfig"
],
"snapshotSerializers": ["enzyme-to-json/serializer"]
}
5 changes: 0 additions & 5 deletions kiwicom/etc/.eslintrc

This file was deleted.

12 changes: 7 additions & 5 deletions kiwicom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
"storybook:build": "build-storybook",
"clean": "rimraf es lib"
},
"keywords": ["kiwi", "ui", "library", "component"],
"keywords": [
"kiwi",
"ui",
"library",
"component"
],
"author": "kiwi.com",
"license": "MIT",
"dependencies": {
Expand All @@ -29,9 +34,6 @@
"babel-eslint": "^8.2.1",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"enzyme-to-json": "^3.3.1",
"eslint": "^4.17.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-prettier": "^2.9.0",
Expand All @@ -49,7 +51,7 @@
"rimraf": "^2.6.2"
},
"jest": {
"setupFiles": ["raf/polyfill", "./etc/enzymeSetup"],
"setupFiles": ["raf/polyfill", "../config/enzymeConfig"],
"snapshotSerializers": ["enzyme-to-json/serializer"]
}
}
24 changes: 21 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,44 @@
{
"name": "kiwi-ui",
"version": "0.0.0",
"scripts": {},
"keywords": ["kiwi", "ui", "library", "component"],
"scripts": {
"eslint": "eslint .",
"flow:check": "flow check",
"test": "jest --config=jest.json",
"test-ci": "yarn flow:check && yarn eslint && yarn test"
},
"keywords": [
"kiwi",
"ui",
"library",
"component"
],
"author": "kiwi.com",
"license": "MIT",
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-eslint": "^8.2.1",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"enzyme-to-json": "^3.3.1",
"eslint": "^4.17.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-flowtype": "^2.44.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jest": "^21.12.2",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-prettier": "^2.6.0",
"eslint-plugin-react": "^7.6.1",
"flow-bin": "^0.65.0",
"prettier": "^1.10.2"
},
"private": true,
"workspaces": ["blkn", "kiwicom", "icons"]
"workspaces": [
"blkn",
"kiwicom",
"icons"
]
}
15 changes: 15 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@
react-inspector "^2.2.2"
uuid "^3.1.0"

"@storybook/addon-actions@^3.3.14":
version "3.3.14"
resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-3.3.14.tgz#b78e707b32130ad16ea8a0af62a66f23b5df502b"
dependencies:
deep-equal "^1.0.1"
global "^4.3.2"
make-error "^1.3.2"
prop-types "^15.6.0"
react-inspector "^2.2.2"
uuid "^3.1.0"

"@storybook/addon-links@^3.3.13":
version "3.3.13"
resolved "https://registry.yarnpkg.com/@storybook/addon-links/-/addon-links-3.3.13.tgz#ea27db37e609a9036e4e6164ed52edf768b99eef"
Expand Down Expand Up @@ -2909,6 +2920,10 @@ eslint-plugin-import@^2.8.0:
minimatch "^3.0.3"
read-pkg-up "^2.0.0"

eslint-plugin-jest@^21.12.2:
version "21.12.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-21.12.2.tgz#325f7c6a5078aed51ea087c33c26792337b5ba37"

eslint-plugin-jsx-a11y@^6.0.3:
version "6.0.3"
resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.0.3.tgz#54583d1ae442483162e040e13cc31865465100e5"
Expand Down

0 comments on commit a1eda68

Please sign in to comment.