Search code examples
reactjstravis-ci

How not to treat warnings as errors with Travis for React


I'm developing an application with React, with Travis continuous integration system. When executing the process, Travis complains about warnings, and fails to compile because it indicates:

Treating warnings as errors because process.env.CI = true. Most CI servers set it automatically. Failed to compile.

I tried to modify the .travis.yml file and add the rule warnings_are_errors: false as indicated in this other post, but it simply ignores it and does not work.


Solution

  • Ok, I will post this solution in case anyone has the same issue. To solve it, I've just modified the rule of the build process in the .travis.yml file.

    Finally, the result of that file is like this:

    script:
      - npm install -g codecov
      - npm test && codecov
      - CI=false npm run build
      - npm run docs
    

    With that option, Travis just recognizes the CI=false to allow the system not to treat warnings as errors.