Jest: Make console clearing with --watch optional

Created on 21 Feb 2017  路  13Comments  路  Source: facebook/jest

I am using jest --watch in a docker container, which runs alongside some other development services on docker (namely webpack). When the tests re run, the console gets cleared (I understand this is desired behavior). Problem is, that gets rid of the logs from my other services. I really think that clearing the console should be optional, perhaps via an opt-out flag (jest --watch --no-clear or something).

Most helpful comment

You can use "CI=true jest --watch" which should work for this use-case.

All 13 comments

In addition to this, (related because the problem I'm trying to solve would only apply to scenarios where the output needs to be logged out, not just viewed) it would be cool to make the interactive element (press p to filter by a filename... etc.) optional as well - as it's not possible to use this when viewing the logs through docker-compose, so is kinda confusing/misleading.

You can use "CI=true jest --watch" which should work for this use-case.

@cpojer Is there any documentation for this? I have just tried and it makes no difference for me...

Can anyone provide any other insight on this issue? @cpojer's solution above didn't make any difference :confounded:

it would be cool to make the interactive element (press p to filter by a filename... etc.) optional as well

This will be resolved in the next release: https://github.com/facebook/jest/pull/3078

@thymikee it will make it nicer too look at, but in a situation where it's not possible to interact at all (such as ci pipelines or, in my case, running inside docker), I was suggesting that this feature should be deactivated altogether.

Can anyone provide any other insight on my original issue - stopping the console from being cleared? Running CI=true jest --watch did not seem to make any difference for me. Is it possible I am doing something wrong?

So currently there's no option to do that in watch mode, because of this line: https://github.com/facebook/jest/blob/v19.0.2/packages/jest-cli/src/watch.js#L101

Maybe we could make it configurable, what do you think @cpojer?

Hi @cpojer, any reason this was closed again? There doesn't seem to be any resolution/fix? You still haven't replied to my comments aimed at you above?

cc @thymikee

Many thanks.

I'm sorry, I meant to add some context but got side-tracked. I don't think at this point we'll be adding support for this feature, so I closed this issue.

That's a shame. I can't use jest with my current stack because of this. :-1:

Also note another person with the same issue: #3213

Hmm, that's not great. Maybe we should figure out what workaround might work for you. I'm a bit unsure why "CI=true jest --watch" didn't work. That may actually be a Jest bug, so I'm gonna reopen this issue but we'd appreciate PRs to fix this.

Ah, that's brilliant! Last time I was deving into the code base I was a bit overwhelmed but I'll take another look this week and try to get a PR submitted.

Was this page helpful?
0 / 5 - 0 ratings