jest-community / jest-runner-eslint

An ESLint runner for Jest
MIT License
480 stars 46 forks source link

Report "warn" somehow #21

Open Haroenv opened 6 years ago

Haroenv commented 6 years ago

This is not a feature of jest, but it's useful to keep things as a warning when you know that a project isn't finished yet. For example todo comments are useful to keep track of where you are in finishing, but also still useful to see in the tests, without needing to fail for it.

keplersj commented 6 years ago

I kinda handle this in jest-runner-tslint. I mark the test as passing but still provide a formatted output with the warnings. Would that work here?

ljharb commented 6 years ago

9 is for reporting ignored files; it would be nice to also have a way to display warnings (but i'm fine if it's not the default).

Haroenv commented 6 years ago

Skipped and warn could indeed probably use the same UI

keplersj commented 6 years ago

@Haroenv I agree that it could, but I don't think that it should.

I think that skipped should only be used for files that are actually skipped by the linter, but files with just warnings should be marked as passed and print their warnings.

ljharb commented 6 years ago

I definitely don't think they should be the same.

However, I'm not sure I'm comfortable with marking warnings as "passed" while still printing the output (but I don't have a better suggestion)

rogeliog commented 6 years ago

Hi! Thanks for reporting and sorry for the late response, I've been sick

Yeah I agree that it is a bit weird. I think this type of examples are great for maturing the jest-runners in general, given that right now it works specifically for Jest use cases, but there areas like this could be generalized to support this use cases

suchipi commented 6 years ago

In a project I'm working on, we treat warnings and errors more-or-less the same (we run eslint in CI with --max-warnings 0), but we use both errors and warnings because it's nice to see different colors for different things in the editor. In order to get warnings to count as failures with jest-runner-eslint, I wrote a second config that pulls in our normal config and changes all the "warn"s to "error". Then I tell jest-runner-eslint to use that config using the cliOptions.config option.