Skip to content

Commit

Permalink
Added git hooks & removed useless commands
Browse files Browse the repository at this point in the history
  • Loading branch information
djhi committed Jun 5, 2019
1 parent 1096d25 commit 4b0e25d
Show file tree
Hide file tree
Showing 6 changed files with 457 additions and 20 deletions.
5 changes: 5 additions & 0 deletions .huskyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"hooks": {
"pre-commit": "lint-staged"
}
}
8 changes: 8 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"*.{js,jsx,ts,tsx}": [
"prettier",
"tslint --fix",
"git add",
"jest --findRelatedTests"
]
}
13 changes: 2 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,8 @@ prettier: ## prettify the source code using prettier
test: build test-unit lint test-e2e ## launch all tests

test-unit: ## launch unit tests
@if [ "$(CI)" != "true" ]; then \
echo "Running unit tests..."; \
yarn -s test-unit; \
fi
@if [ "$(CI)" = "true" ]; then \
echo "Running unit tests in CI..."; \
yarn -s test-unit-ci; \
fi

test-unit-watch: ## launch unit tests and watch for changes
yarn -s test-unit --watch
echo "Running unit tests...";
yarn -s test-unit;

test-e2e: ## launch end-to-end tests
@if [ "$(build)" != "false" ]; then \
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,21 @@ or
yarn test
```

When working on the end to end tests, you can leverage [cypress](https://www.cypress.io/) runner by starting the simple example yourself (`make run-simple`) and starting cypress in another terminal (`make test-e2e-local` or `yarn test-e2e-local`).
To start a full test run without watching changes, call:

```sh
CI=true make test
```

or

```sh
CI=true yarn test
```

Besides, tests related to the modified files are ran automatically at commit.

When working on the end to end tests, you can leverage [cypress](https://www.cypress.io/) runner by starting the simple example yourself (`make run-simple` or `yarn run-simple`) and starting cypress in another terminal (`make test-e2e-local` or `yarn test-e2e-local`).

If you have coding standards problems, you can fix them automatically using `prettier` by calling

Expand All @@ -205,6 +219,8 @@ or
yarn prettier
```

However, these commands are ran automatically at each commit so you shouldn't have to worry about them.

If you want to contribute to the documentation, install [jekyll](https://jekyllrb.com/docs/home/), then call

```sh
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
"build": "lerna run build",
"build-demo": "cd examples/demo && cross-env REACT_APP_DATA_PROVIDER=rest yarn -s build",
"test-unit": "cross-env NODE_ENV=test cross-env BABEL_ENV=cjs NODE_ICU_DATA=node_modules/full-icu jest",
"test-unit-ci": "cross-env NODE_ENV=test cross-env BABEL_ENV=cjs NODE_ICU_DATA=node_modules/full-icu jest --runInBand",
"test-e2e": "yarn run -s build && cross-env NODE_ENV=test && cd cypress && yarn -s test",
"test-e2e-local": "cd cypress && yarn -s start",
"test": "yarn -s test-unit && yarn -s test-e2e",
"test-ci": "yarn -s test-unit-ci && yarn -s test-e2e",
"doc": "cd docs && jekyll server . --watch",
"lint": "eslint ./packages/**/src ./examples/**/src ./cypress/**",
"lint": "tslint ./packages/**/src ./examples/**/src ./cypress/**",
"prettier": "prettier --config ./.prettierrc.js --write --list-different \"packages/*/src/**/*.{js,json,ts,tsx,css,md}\" \"examples/*/src/**/*.{js,ts,json,tsx,css,md}\" \"cypress/**/*.{js,ts,json,tsx,css,md}\"",
"run-simple": "cd examples/simple && yarn -s start",
"run-tutorial": "yarn run -s build && cd examples/tutorial && yarn -s start",
Expand Down Expand Up @@ -45,8 +43,10 @@
"cross-env": "^5.2.0",
"express": "~4.16.3",
"full-icu": "~1.2.1",
"husky": "^2.3.0",
"jest": "^23.6.0",
"lerna": "~2.9.1",
"lint-staged": "^8.1.7",
"lolex": "~2.3.2",
"mutationobserver-shim": "^0.3.3",
"prettier": "~1.17.1",
Expand Down
Loading

0 comments on commit 4b0e25d

Please sign in to comment.