Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jest dont show tests when there are more than one suite

Im testing my app. When I run 'npm test' I want to see in the terminal all tests. I have one file called auth.test.js with all my tests.

So my output when i run npm test is this one:

> jest --forceExit

 PASS  src/test/auth.test.js
  /LOGIN testing
    ✓ Should not login a unexistent username. (22ms)
    ✓ Should not login with incorrect credentials. (63ms)
    ✓ Should not login with empty fields. (2ms)
    ✓ Should login a moked user. (67ms)
  /SIGNUP testing
    ✓ Should not sign up a new user with invalid password. (3ms)
    ✓ Should not sign up a new user with invalid username. (2ms)
    ✓ Should sign up a new user. (72ms)
    ✓ Should not sign up a existing user. (4ms)
    ✓ Should not sign up with empty fields. (3ms)

Test Suites: 1 passed, 1 total
Tests:       9 passed, 9 total
Snapshots:   0 total
Time:        1.114s, estimated 2s
Ran all test suites.

Thats fine. I can see all tests with details.

Now, I want to add a new file with tests, called api.tests.js.

Then, when I run 'npm test' i see this output:

> jest --forceExit

 PASS  src/test/api.test.js
 PASS  src/test/auth.test.js

Test Suites: 2 passed, 2 total
Tests:       10 passed, 10 total
Snapshots:   0 total
Time:        1.589s, estimated 2s
Ran all test suites.

After read the jest documentation (cli article) I cant found how to see the details, like I see when testing 1 file, but when testing more than 1 file.

Is it posible? How to do it?

like image 812
franlol Avatar asked Sep 21 '25 00:09

franlol


1 Answers

You're probably getting npm --verbose results which look different. To get jest --verbose, add two hyphens to your command: -- --verbose. I had the same problem and it worked for me.

I got the solution from here: Is there an option to show all test descriptions when I run jest tests?

like image 131
Kiira Avatar answered Sep 23 '25 04:09

Kiira