-
Notifications
You must be signed in to change notification settings - Fork 84
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
Neotest shows that test failed even when it doesn't #94
Comments
I am in a similar boat, although I do not see any green checkmarks in the status window, only a top-level x. The output tells me the tests passed, though. Sort of new to neovim, can you point me to where it might be logging the actual error? This is the same situation where I have a monorepo (nx in my case) where I have set |
I figured this out, at least for my setup. We had |
Haven't thought about that David. I checked it and the json is correct. For example for the failed test: {
"numFailedTestSuites": 0, // <--
"numFailedTests": 0,
"numPassedTestSuites": 1,
"numPassedTests": 4, // <--
"numPendingTestSuites": 0,
"numPendingTests": 0,
"numRuntimeErrorTestSuites": 0,
"numTodoTests": 0,
"numTotalTestSuites": 1,
"numTotalTests": 4,
"openHandles": [],
"snapshot": {
"added": 0,
"didUpdate": false,
"failure": false,
"filesAdded": 0,
"filesRemoved": 0,
"filesRemovedList": [],
"filesUnmatched": 0,
"filesUpdated": 0,
"matched": 0,
"total": 0,
"unchecked": 0,
"uncheckedKeysByFile": [],
"unmatched": 0,
"updated": 0
},
"startTime": 1704434251739,
"success": true,
"testResults": [
{
"assertionResults": [
{
"ancestorTitles": ["Counter"],
"duration": 16,
"failureDetails": [],
"failureMessages": [],
"fullName": "Counter should render",
"invocations": 1,
"location": null,
"numPassingAsserts": 1,
"retryReasons": [],
"status": "passed",
"title": "should render"
},
{
"ancestorTitles": ["Counter"],
"duration": 3,
"failureDetails": [],
"failureMessages": [],
"fullName": "Counter should render with default value",
"invocations": 1,
"location": null,
"numPassingAsserts": 1,
"retryReasons": [],
"status": "passed",
"title": "should render with default value"
},
{
"ancestorTitles": ["Counter"],
"duration": 30,
"failureDetails": [],
"failureMessages": [],
"fullName": "Counter should increment value",
"invocations": 1,
"location": null,
"numPassingAsserts": 1,
"retryReasons": [],
"status": "passed",
"title": "should increment value"
},
{
"ancestorTitles": ["Counter"],
"duration": 12,
"failureDetails": [],
"failureMessages": [],
"fullName": "Counter should decrement value",
"invocations": 1,
"location": null,
"numPassingAsserts": 1,
"retryReasons": [],
"status": "passed",
"title": "should decrement value"
}
],
"endTime": 1704434252954,
"message": "",
"name": "/Users/demian/Desktop/program-learning/ulbitv/react-production/react-production/src/entities/Counter/ui/Counter.test.tsx",
"startTime": 1704434252071,
"status": "passed",
"summary": ""
}
],
"wasInterrupted": false
} Do you have any idea why this might happen? |
I'm unsure if this is related but I've got the same symptom (tests passing and shown to be passing in output_panel logs, but status in neotest is failed). The output json is created and parsed by neotest, but I can see it adds a whole bunch of failed missing nodes when being parsed in results callback. In my case the missing nodes have all dropped the outer describe block from my test suite. eg. I end up with two elements in the results parsed by neotest:
and one missing the describe:
I've already put too much time into this right now so can't go further unfortunately. My guess is that the tree is being built incorrectly - I can't see if that's done in the adapter or in neotest itself. In case it's helpful here's my config, my project is in a monorepo:
|
I have the same issue. Did anyone come up with a solution for this? |
Just what I mentioned above with my |
I have the same issue. No weird symbols in my tests files :( Any ideas what could it be? |
Just a possible hint for this - I realized that in our top level Changing the test to pass a string instead of the component definition directly fixes the issue. |
Seems relate to the jest version or pnpm/npm how to run the commands. In my previous nvim neotest setup, I use following config for neotest-jest:
You can see I was using |
Removing the This is the jest command I'm using in my project
Few things I observed...
So based on this, with jestCommand written in the 3rd way seems to work for me. |
I have the same issue when running test, in the output it shows the test where successful, in the summary they show as skipped or failed. |
When using Lazyvim with Neotest, I'm encountering a problem where Neotest incorrectly shows tests as failed even though they pass, particularly when the Jest config is not in the root directory.
CleanShot.2023-12-07.at.16.04.26.mp4
I think this is the issue how neotest-jest interprets jest config. If my jest config is on the root of the repo. I almost don't see this behaviour:
My config:
The only behaviour that I debugged was that this happens with a custom config directory like (./config/jest/jest.config.ts).
My jest config:
The text was updated successfully, but these errors were encountered: