Skip to content

Commit

Permalink
chore(cypress): ensure server is ready before launching tests (#4)
Browse files Browse the repository at this point in the history
As @bahmutov mentioned it on #3, there is an edge case where the server could "not" be ready when launching tests if using `--race` flag with `npm-run-all`.

Fixed it using [start-server-and-test](https://github.com/bahmutov/start-server-and-test).

Fixes #3
  • Loading branch information
topheman committed Apr 23, 2018
1 parent 242071f commit dc47531
Show file tree
Hide file tree
Showing 2 changed files with 135 additions and 4 deletions.
127 changes: 127 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions package.json
Expand Up @@ -61,13 +61,16 @@
"test:travis:pr": "npm test",
"test:unit": "cross-env CI=true npm run test:unit:watch",
"test:unit:watch": "react-scripts --require ./bin/expand-metadatas.js test --env=jsdom",
"test:cypress": "npm-run-all build --parallel --race serve cy:run",
"test:cypress:travis": "npm-run-all build --parallel --race serve 'cy:run -- --record --config videoRecording=true'",
"test:cypress": "npm run build && npm run cy:start-server-and-test",
"test:cypress:travis": "npm run build && npm run cy:start-server-and-test:travis",
"test:cypress:dev": "npm-run-all --parallel --race start 'cy:open -- --config baseUrl=http://localhost:3000'",
"cy:open": "cypress open",
"cy:run": "cypress run",
"cy:run:travis": "npm run cy:run -- --record --config videoRecording=true",
"cy:start-server-and-test": "npx start-server-and-test serve :5000 cy:run",
"cy:start-server-and-test:travis": "npx start-server-and-test serve :5000 cy:run:travis",
"test:precommit": "npm test",
"serve": "npx serve build",
"serve": "npx serve --port 5000 build",
"eject": "react-scripts eject",
"lint": "npx eslint .",
"pretty": "npx prettier --write '**/*.{js,jsx,json,css,scss}'",
Expand Down Expand Up @@ -105,7 +108,8 @@
"npm-run-all": "^4.1.2",
"prettier": "1.11.1",
"react-testing-library": "^2.0.0",
"serve": "^6.5.3"
"serve": "^6.5.3",
"start-server-and-test": "^1.4.1"
},
"proxy": {
"/api/npm-registry": {
Expand Down

0 comments on commit dc47531

Please sign in to comment.