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

describe wrapper makes all the test gutter icons to be ? #715

Closed
cy6erskunk opened this issue May 24, 2021 · 10 comments · Fixed by #724
Closed

describe wrapper makes all the test gutter icons to be ? #715

cy6erskunk opened this issue May 24, 2021 · 10 comments · Fixed by #724

Comments

@cy6erskunk
Copy link

Environment

  1. vscode-jest version: 4.0.1
  2. node -v: v14.16.1
  3. yarn --version: 1.22.10
  4. npm ls jest: └── [email protected]
  5. your vscode-jest settings if customized: nothing customized
  6. Operating system: macOS Catalina 10.15.7

Prerequisite

  • are you able to run jest test from the command line? yes
  • how do you run your tests from the command line? yarn test

Steps to Reproduce

could not repro an issue in a newly created repo yet

Relevant Debug Info

[fill]

Expected Behavior

test statuses are displayed as green checkmarks or red crosses

Actual Behavior

test statuses are always shown as ?, unless a describe('component', () => ... }) wrapper is removed.
Jest WS stats are also dispalyed correctly

@connectdotz
Copy link
Collaborator

It sounds like this might be a test result matching issue... Please turn on the “jest.debugMode” and see if there is any warning in the developer tool console.

@cy6erskunk
Copy link
Author

Got these two warnings for a file with a single test:

[/.../index.spec.tsx] !! context mismatched !! container nodes are different under "__root__: either different test count or with unknown locations within the block":   
details
source=
{
    "childContainers": [
        {
            "childContainers": [],
            "childData": [
                {
                    "name": "should render without errors",
                    "zeroBasedLine": 5,
                    "data": [
                        {
                            "type": "it",
                            "file": "/src/packages/loading-state/src/index.spec.tsx",
                            "start": {
                                "line": 6,
                                "column": 3
                            },
                            "end": {
                                "line": 8,
                                "column": 5
                            },
                            "name": "should render without errors",
                            "nameRange": {
                                "start": {
                                    "column": 7,
                                    "line": 6
                                },
                                "end": {
                                    "column": 34,
                                    "line": 6
                                }
                            },
                            "children": [
                                {
                                    "type": "expect",
                                    "file": "/src/packages/loading-state/src/index.spec.tsx",
                                    "start": {
                                        "line": 7,
                                        "column": 5
                                    },
                                    "end": {
                                        "line": 7,
                                        "column": 59
                                    }
                                }
                            ]
                        }
                    ]
                }
            ],
            "name": "LoadingState",
            "zeroBasedLine": 5
        }
    ],
    "childData": [],
    "name": "__root__",
    "zeroBasedLine": 5
}

assertion=
{
    "childContainers": [],
    "childData": [
        {
            "name": "should render without errors",
            "zeroBasedLine": 5,
            "data": [
                {
                    "line": null,
                    "message": "",
                    "shortMessage": null,
                    "status": "KnownSuccess",
                    "terseMessage": null,
                    "title": "should render without errors",
                    "location": {
                        "column": 2,
                        "line": 5
                    },
                    "fullName": "LoadingState should render without errors",
                    "ancestorTitles": []
                }
            ]
        }
    ],
    "name": "__root__",
    "zeroBasedLine": 5
}
S @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:35
_doInvokeHandler @ rpcProtocol.ts:417
_invokeHandler @ rpcProtocol.ts:402
_receiveRequest @ rpcProtocol.ts:318
_receiveOneMessage @ rpcProtocol.ts:245
(anonymous) @ rpcProtocol.ts:110
fire @ event.ts:622
fire @ ipc.net.ts:468
_receiveMessage @ ipc.net.ts:821
(anonymous) @ ipc.net.ts:660
fire @ event.ts:622
acceptChunk @ ipc.net.ts:241
(anonymous) @ ipc.net.ts:202
_ @ ipc.net.ts:50
emit @ events.js:315
addChunk @ internal/streams/readable.js:309
readableAddChunk @ internal/streams/readable.js:284
Readable.push @ internal/streams/readable.js:223
onStreamRead @ internal/stream_base_commons.js:188
console.ts:137 [Extension Host] 
[/.../index.spec.tsx] !! match failed !! describe: "LoadingState": undefined
details

source= {
"childContainers": [],
"childData": [
{
"name": "should render without errors",
"zeroBasedLine": 5,
"data": [
{
"type": "it",
"file": "/src/packages/loading-state/src/index.spec.tsx",
"start": {
"line": 6,
"column": 3
},
"end": {
"line": 8,
"column": 5
},
"name": "should render without errors",
"nameRange": {
"start": {
"column": 7,
"line": 6
},
"end": {
"column": 34,
"line": 6
}
},
"children": [
{
"type": "expect",
"file": "/src/packages/loading-state/src/index.spec.tsx",
"start": {
"line": 7,
"column": 5
},
"end": {
"line": 7,
"column": 59
}
}
]
}
]
}
],
"name": "LoadingState",
"zeroBasedLine": 5
}
assertion= undefined

</details>

@joehallaschameleon
Copy link

Hi, just wanted to let you know I have the same issue on Windows using vscode-jest version 4.0.2. As above, removing the describe wrapper resolves the problem. Using same version of jest, but installed using npm.

@cy6erskunk
Copy link
Author

I've checked that I also have version 4.0.2 now, still the same behaviour.

@connectdotz
Copy link
Collaborator

hi, thanks for the detailed log message, it is very helpful. I can see the problem in the assertion block (the first log message) that it did not report the ancestor (the describe block) correctly: it shows "ancestorTitles": [] where it should be "ancestorTitles": ["LoadingState"].

This data is produced by jest, but I could not reproduce it in various of my test projects...

Wondering if your project is somehow using a custom testResultsProcessor or maybe there is a bug in jest somehow triggered in your particular setting? Are you guys using some other framework like react/angular? Can you try to dump the jest config like yarn test --showConfig?

If you can produce a repo to show this problem that will probably be the fastest way to narrow it down.

@cy6erskunk
Copy link
Author

Thanks for the suggestion to check for a custom testResultsProcessor, it seems like JUnit reporter is causing the issue, I've created a repro: https://github.com/cy6erskunk/vscode-jest-bug

@connectdotz
Copy link
Collaborator

connectdotz commented May 26, 2021

just curious, what is the reason to use JUnit reporter? Is some framework you use depends on it? It seems pretty old, the latest version is published 4 years ago.

@cy6erskunk
Copy link
Author

We used to use it extensively in our CI to generate xml reports to feed them to Jenkins. Should be not needed in the projects migrated to GitHub Actions.

@connectdotz
Copy link
Collaborator

@cy6erskunk I think we found a way to improve the match fault tolerance, please feel free to give the following pre-release a try and let us know if it works.

vscode-jest-4.0.3-rc.2.vsix.zip

@cy6erskunk
Copy link
Author

@connectdotz I've just checked the pre-release, works like a charm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants