Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running jest without --verbose #886

Closed
araujoarthur0 opened this issue Oct 25, 2022 · 10 comments · Fixed by #1013 or #1024
Closed

Running jest without --verbose #886

araujoarthur0 opened this issue Oct 25, 2022 · 10 comments · Fixed by #1013 or #1024
Labels
enhancement New feature or request

Comments

@araujoarthur0
Copy link
Collaborator

I just found out we always run jest with --verbose, which seems to eat up any console.log() that we might add while trying to debug tests (that took me almost an hour).
Do we have a strong reason for that? I took it out and didn't see much difference in the common logs.

@araujoarthur0 araujoarthur0 added the enhancement New feature or request label Oct 25, 2022
@araujoarthur0 araujoarthur0 changed the title Running jest with --verbose Running jest without --verbose Oct 25, 2022
@tupaschoal
Copy link
Collaborator

I don't remember any, I'd say go for it.

pallasite99 added a commit to pallasite99/time-to-leave that referenced this issue Oct 8, 2023
@pallasite99
Copy link
Contributor

Hi @tupaschoal @araujoarthur0!

I made the necessary changes in the linked PR but I am not being able to run the setup locally due to possible mismatch in my installed NodeJS version.

So for a sanity check I would request one of you to see whether the intended changes work and solve the issue, else it is good to go since this is a non-breaking change.

@araujoarthur0
Copy link
Collaborator Author

Hi @pallasite99 what kind of issue are you having?

@pallasite99
Copy link
Contributor

@araujoarthur0 It was a temporary issue with npm. It is resolved now and I have this as proof of working:

Run `npm audit` for details.
PS C:\Users\Dell\OneDrive\Documents\GitHub\time-to-leave> npm run test:jest

> [email protected] test:jest
> jest --runInBand --detectOpenHandles --colors --transformIgnorePatterns 'node_modules/(?!astronomia)/' --

 PASS       MAIN  __tests__/__main__/menus.js
  ● Console

    console.log
      { response: 1 }

This is the final result which is as expected since this is a non-breaking change:

---------------------------------------------------------------------------------------

Test Suites: 19 passed, 19 total
Tests:       382 passed, 382 total
Snapshots:   0 total
Time:        131.417 s
Ran all test suites in 2 projects.

@araujoarthur0
Copy link
Collaborator Author

Great, @pallasite99 !
Where did you add the log line?
Because I was trying this out as well and mine failed to show anything this time 😭

@araujoarthur0
Copy link
Collaborator Author

Could you also paste this test in the PR?

@pallasite99
Copy link
Contributor

pallasite99 commented Oct 10, 2023

@araujoarthur0 Actually I didn't make any changes to the unit tests in the PR so this console was already present in the codebase 😀

Let me check if I can find the test after getting back to my desk in a while.

Edit: Linked the findings to the PR in a comment

@araujoarthur0
Copy link
Collaborator Author

Apparently when running a single test file (like npm run test:jest workday-waiver.js) jest will still force the verbose mode, which hides the console logs we could have used for debug.
We can add --verbose=false to override this behavior. I'm reopening this just because the end goal was to allow the console log to always work.

@pallasite99
Copy link
Contributor

pallasite99 commented Oct 25, 2023

Hi @araujoarthur0 sorry I came down with fever during the weekend. This PR implements the final changes you requested:

#1024

Please review when possible, thanks!

(node:5964) electron: The default of contextIsolation is deprecated and will be changing from false to true in a future release of Electron.  See https://github.com/electron/electron/issues/23506 for more information
 PASS       MAIN  __tests__/__main__/menus.js
  ● Console

    console.log
      { response: 1 }

      at js/menus.js:365:29
(node:3125) electron: The default of contextIsolation is deprecated and will be changing from false to true in a future release of Electron.  See https://github.com/electron/electron/issues/23506 for more information
 PASS   RENDERER  __tests__/__renderer__/classes/BaseCalendar.js
  ● Console
    console.log
      undefined

      at js/classes/BaseCalendar.js:89:25

@araujoarthur0
Copy link
Collaborator Author

Hope you're feeling better now @pallasite99 ! Thanks for submitting the PR, will take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants