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

[Bug] coverage reports Unknown% with --watch #9484

Closed
baslr opened this issue Jan 29, 2020 · 3 comments
Closed

[Bug] coverage reports Unknown% with --watch #9484

baslr opened this issue Jan 29, 2020 · 3 comments

Comments

@baslr
Copy link

baslr commented Jan 29, 2020

🐛 Bug Report

To Reproduce

Steps to reproduce the behavior:

repo https://github.com/baslr/node-template

When I add a test and try jest with --watch, --watchAll on macOS and WSL: Debian I get:

git diff src/
diff --git a/src/__tests__/app.test.mjs b/src/__tests__/app.test.mjs
index 5be908d..a4a1646 100755
--- a/src/__tests__/app.test.mjs
+++ b/src/__tests__/app.test.mjs
@@ -14,4 +14,9 @@ describe('test app', () => {
         const ret = square(3, 3);
         expect(ret).toBe(36);
     });
+
+    test('test two', () => {
+        const ret = square(3, 3);
+        expect(ret).toBe(36);
+    });




npx jest --watch
PASS src/__tests__/app.test.mjs
  test app
    ✓ test mul (1ms)
    ✓ test suqare (1ms)
    ✓ test foo
    ✓ test two (1ms)

----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |       0 |        0 |       0 |       0 |                   
----------|---------|----------|---------|---------|-------------------

=============================== Coverage summary ===============================
Statements   : Unknown% ( 0/0 )
Branches     : Unknown% ( 0/0 )
Functions    : Unknown% ( 0/0 )
Lines        : Unknown% ( 0/0 )
================================================================================
Test Suites: 1 passed, 1 total
Tests:       4 passed, 4 total
Snapshots:   0 total
Time:        1.024s
Ran all test suites related to changed files.




npx jest --watchAll
PASS src/__tests__/app.test.mjs
  test app
    ✓ test mul (2ms)
    ✓ test suqare (1ms)
    ✓ test foo
    ✓ test two

----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |     100 |      100 |     100 |     100 |                   
 app.mjs  |     100 |      100 |     100 |     100 |                   
----------|---------|----------|---------|---------|-------------------

=============================== Coverage summary ===============================
Statements   : 100% ( 6/6 )
Branches     : 100% ( 0/0 )
Functions    : 100% ( 2/2 )
Lines        : 100% ( 5/5 )
================================================================================
Test Suites: 1 passed, 1 total
Tests:       4 passed, 4 total
Snapshots:   0 total
Time:        1.115s
Ran all test suites.




npx jest --watch --coverage
PASS src/__tests__/app.test.mjs
  test app
    ✓ test mul (2ms)
    ✓ test suqare
    ✓ test foo (1ms)
    ✓ test two

----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |       0 |        0 |       0 |       0 |                   
----------|---------|----------|---------|---------|-------------------

=============================== Coverage summary ===============================
Statements   : Unknown% ( 0/0 )
Branches     : Unknown% ( 0/0 )
Functions    : Unknown% ( 0/0 )
Lines        : Unknown% ( 0/0 )
================================================================================
Test Suites: 1 passed, 1 total
Tests:       4 passed, 4 total
Snapshots:   0 total
Time:        1.003s
Ran all test suites related to changed files.




npx jest --watchAll --coverage
PASS src/__tests__/app.test.mjs
  test app
    ✓ test mul (2ms)
    ✓ test suqare
    ✓ test foo
    ✓ test two

----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |     100 |      100 |     100 |     100 |                   
 app.mjs  |     100 |      100 |     100 |     100 |                   
----------|---------|----------|---------|---------|-------------------

=============================== Coverage summary ===============================
Statements   : 100% ( 6/6 )
Branches     : 100% ( 0/0 )
Functions    : 100% ( 2/2 )
Lines        : 100% ( 5/5 )
================================================================================
Test Suites: 1 passed, 1 total
Tests:       4 passed, 4 total
Snapshots:   0 total
Time:        1.025s
Ran all test suites.

Expected behavior

=============================== Coverage summary ===============================
Statements   : Unknown% ( 0/0 )
Branches     : Unknown% ( 0/0 )
Functions    : Unknown% ( 0/0 )
Lines        : Unknown% ( 0/0 )
================================================================================

should not be Unknown%

Link to repl

https://github.com/baslr/node-template

envinfo

WSL: Debian, macOS 10.12.6 both with Node.js v12.14.1

related to jest-community/vscode-jest#551

@github-actions
Copy link

This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Feb 17, 2023
@github-actions
Copy link

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 19, 2023
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants