create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

Passing "CI=true" fails to prevent successful build when tests fail if building on Linux (bash)

Open ConsciousUniverse opened this issue 8 years ago • 6 comments

Is this a bug report?

Yes.

Did you try recovering your dependencies?

Yes.

Which terms did you search for in User Guide?

N/A

Environment

System: OS: Linux 4.18 Ubuntu 18.10 (Cosmic Cuttlefish) CPU: x64 Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz Binaries: Node: 10.13.0 - ~/.nvm/versions/node/v10.13.0/bin/node npm: 6.4.1 - ~/.nvm/versions/node/v10.13.0/bin/npm Browsers: Chrome: 70.0.3538.102 Firefox: 63.0 npmPackages: react: ^16.6.3 => 16.6.3 react-dom: ^16.6.3 => 16.6.3 react-scripts: 2.1.1 => 2.1.1 npmGlobalPackages: create-react-app: Not Found

Steps to Reproduce

  1. Write tests, (shallow, using enzyme), as described in the official docs, here: https://facebook.github.io/create-react-app/docs/running-tests
  2. Ensure one of the tests fails when running: npm run test
  3. Attempt to build, by running: CI=true npm run build

Expected Behavior

The build would fail, due to the failure of the test.

Actual Behavior

The build succeeds without any issues.

ConsciousUniverse avatar Nov 19 '18 19:11 ConsciousUniverse

Building does not run your tests -- this is the expected behavior.

Timer avatar Nov 19 '18 19:11 Timer

Building does not run your tests -- this is the expected behavior.

Am I misunderstanding this, in the docs then:

When creating a build of your application with npm run build linter warnings are not checked by default. Like npm test, you can force the build to perform a linter warning check by setting the environment variable CI. If any warnings are encountered then the build fails.

As per https://facebook.github.io/create-react-app/docs/running-tests#linux-macos-bash

ConsciousUniverse avatar Nov 19 '18 19:11 ConsciousUniverse

It's just using npm test as an example, "Like npm test" -- the behavior you're opting into is "perform a linter warning check [and fail the build]".

Send a PR clarifying docs?

Timer avatar Nov 19 '18 20:11 Timer

It's just using npm test as an example, "Like npm test" -- the behavior you're opting into is "perform a linter warning check [and fail the build]".

Send a PR clarifying docs?

Oh right, my mistake, sorry. I was conflating linter warnings and the jest tests, reading it as "force the build to perform a linter warning check [AND TESTS] by setting the environment variable CI...".

I doubt doc clarification is necessary; my stupidity is an extreme edge case :laughing:

ConsciousUniverse avatar Nov 19 '18 20:11 ConsciousUniverse

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

stale[bot] avatar Dec 20 '18 01:12 stale[bot]

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

stale[bot] avatar Dec 25 '18 05:12 stale[bot]