Skip to content

Provide a non-watch way of running tests locally #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 3, 2017

Conversation

randycoulman
Copy link
Contributor

@randycoulman randycoulman commented Jan 27, 2017

When running yarn validate locally, we want the tests to run once and stop, but yarn test runs in watch mode.

This PR adds a test:once script that:

a) sets the CI environment variable, which is the recommended way of disabling watch mode.
b) sets the —coverage flag so that we can see our code coverage information when running the tests.

Fixes #24

@randycoulman randycoulman requested a review from bmatto January 27, 2017 22:18
@bmatto
Copy link
Contributor

bmatto commented Feb 3, 2017

Locally, when I run test, I get the coverage report however it continues to watch. The way the react-scripts is setup the watch flag is not used when running on CI such that CI does not hang. It is recommended by the facebook folks that we set that env flag when we want to run non watch test. See here facebook/create-react-app#784

@@ -35,7 +35,8 @@
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"test": "react-scripts test --env=jsdom --coverage",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add CI=true at the beginning of this line

@randycoulman
Copy link
Contributor Author

@bmatto How about 9399336?

@randycoulman randycoulman merged commit f78e35c into master Feb 3, 2017
@randycoulman randycoulman deleted the non-watch-testing branch February 3, 2017 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants