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

Jest test cases not getting reported into reportPortal - Throw Error: Could not finish Test Step - "Test Name" tempId not found #153

Open
NaitikPandya opened this issue Nov 7, 2024 · 4 comments

Comments

@NaitikPandya
Copy link

I have a react project that uses the jest for test cases.

So i have done the configuration as per your documentation.
Here is my jest configurations.

"jest": {
    "preset": "ts-jest",
    "testTimeout": 100000,
    "maxConcurrency": 10,
    "maxWorkers": "50%",
    "transform": {
      "^.+\\.(ts|tsx)?$": "ts-jest",
      "^.+\\.(js|jsx)$": "babel-jest",
      "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/fileTransformer.js"
    },
    "moduleNameMapper": {
      "\\.(css|less)$": "identity-obj-proxy"
    },
    "moduleDirectories": [
      "node_modules",
      "src"
    ],
    "testPathIgnorePatterns": [
      "<rootDir>/node_modules/"
    ],
    "setupFiles": [
      "jest-canvas-mock",
      "whatwg-fetch",
      "./src/setupJest.ts"
    ],
    "reporters": [
      "default",
      [
        "@reportportal/agent-js-jest",
        {
          "api_key": "<My API KEY>"
          "endpoint": "http://<URL>:8080/api/v1",
          "project": "test_results",
          "description": "Test result",
          "launch": "demo_test",
          "isLaunchMergeRequired": true,
          "launchUuidPrint": true,
          "restClientConfig": {
            "timeout": 0
          }
        }
      ]
    ]
  }

Commonad i'm using to run test cases is
jest --env=jsdom --no-colors -i

still i'm getting this error
Could not finish Test Step - "Test Name" tempId not found

Screenshot of reported test in to reportportal
Screenshot 2024-11-07 at 4 16 57 PM
I Have more the 600+ test cases but only this much is getting log into the report portal

Does any one have any idea so please guide through this as i'm not able getting any proper document & same issue to look and resolve it.

It would be great help if anyone reply as soon as possible.

@NaitikPandya NaitikPandya changed the title Could not finish Test Step - "Test Name" tempId not found Jest test cases not getting reported into reportPortal - Throw Error: Could not finish Test Step - "Test Name" tempId not found Nov 13, 2024
@owens-ben
Copy link

owens-ben commented Dec 5, 2024

I'm having the same issue where the same suite is getting broken up into separate ones, like in the screenshot in the description.

image

Version 5.1.1

EDIT: I think this is the actual issue I'm experiencing: #147

@tristanzander
Copy link
Contributor

Are you using anything like jest.concurrent or the like? If you can reproduce the issue as a regression test in this repo, I may be able to fix it when I have a moment

@owens-ben
Copy link

owens-ben commented Dec 6, 2024

@tristanzander Yes - I'm using Detox which allows multiple executions with --maxWorkers. The issue is new since upgrading from 5.0.6->5.1.1.

What happens is when running concurrently, Jest will frequently invoke _finishSuite prematurely, thus causing it to start a new suite.

I think its invoking it and not being strict about which thread it is deleting the suiteid for.

@owens-ben
Copy link

owens-ben commented Dec 9, 2024

Investigating further, the onTestResult function seems to be invoked too early, causing a new tempSuiteId to be created. I'm trying to fix it myself but would appreciate any guidance.

This is how I understand the issue

Example with 2 test suites

Suite 1 - Test 1.1
Suite 2 - Test 2.1, Test 2.2

Suite 1 & 2 Start
Test 1.1 Starts - creates new tempSuiteID
Test 2.1 Starts - creates new tempSuiteID
Test 1.1 Finishes ≤- onTestResult runs, seemingly deleting the tempSuiteID for test suite 2
Test 2.2 Starts - the next test starts a new tempSuiteId

Edit: it actually seems like it might be related to jest.retryTimes(). Setting this to 0 gets rid of the issue. Will update with any findings.

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

No branches or pull requests

3 participants