nrwl / precise-commits

:sparkles: Painlessly apply Prettier by only formatting lines you have modified anyway!
MIT License
471 stars 20 forks source link

CI (Travis) Integration question #17

Closed hippee-lee closed 1 year ago

hippee-lee commented 6 years ago

Hi there. I know this tool is very new and I suspect this isn't really an issue but I'm not sure where to ask this question.

I'm setting up to use precise-commits so that it checks PRs for proper formatting before tests run. Getting familiar with precise-commits is pretty straight forward and the husky/pre-commit integration works as I would expect.

In adding it to run as a script on Travis for PR's, I added a script to travis.yml that will always run precise-commits on a specific range for my branch. I am expecting to see similar output for running the same command on both travis and my local computer.

Here is what I see on travis: screen shot 2018-05-23 at 11 19 03 am

Here is what I see on my local for the same command / repo / branch: screen shot 2018-05-23 at 11 19 21 am

I would expect them to be the same. The lack of output after the command runs makes me suspect that precise-commits isn't really running on Travis.

Have you seen this before?

llwt commented 6 years ago

Any update on this? We were just discussing this with our team this morning. It would be nice to have a way to output the offending files in CI.

Chebotarev commented 5 years ago

I was having this same issue on CircleCI. I saw a log that precise-commits ran successfully but no output. I added some changes that violated the prettier configuration, it started failing. So at least in my situation it was running but not outputting anything. Looking into this a little deeper, I found that this library uses ora to create those fancy spinners which seems like it does not output anything if it detects a CI environment:

https://github.com/sindresorhus/ora#isenabled https://github.com/sindresorhus/ora/blob/master/index.js#L40

I tried unsetting the CI env var in my configuration and the output showed up. So the quick patch is to add unset CI before running precise-commits, but it's probably a good idea to restore the original value immediately after.

The fix for this should be as simple as passing the isEnabled option to ora.