allure-js icon indicating copy to clipboard operation
allure-js copied to clipboard

[Vitest][Issue] Allure Report Fails to Display Description When Using test.concurrent of Vitest

Open li1225 opened this issue 4 months ago • 0 comments

Describe the bug

In the provided script, I encountered an issue where the Allure report does not display the description or other Allure features correctly when using test.concurrent. However, the description works fine when using test() without concurrent.

describe('Sleep Duration Test', () => {
    test.concurrent.for([2,3,4])('1-1 Should sleep for %i second(s).', async (n, ctx)=> {
        await allure.description(`This is allure description - ${ctx.task.name}`)
        await sleep(n)
        expect(n).toBeLessThan(10)
        logWithTimestamp(`This is ${ctx.task.name}-${n}`)
        logWithTimestamp(`Slept for ${n} second(s)`)
    })

    test.for([2,3,4])('1-2 Should sleep for %i second(s).', async (n, ctx)=> {
        await allure.description(`This is allure description - ${ctx.task.name}`)
        await sleep(n)
        expect(n).toBeLessThan(10)
        logWithTimestamp(`This is ${ctx.task.name}-${n}`)
        logWithTimestamp(`Slept for ${n} second(s)`)
    })
})

Could this be related to how Allure integrates with concurrent tests, or is there something specific that needs to be configured for it to work with test.concurrent?

"dependencies": {
    "@types/allure-js-commons": "^0.0.4",
    "@types/node": "^22.7.2",
    "allure-commandline": "^2.30.0",
    "allure-js-commons": "^3.0.2",
    "allure-vitest": "^3.0.2",
    "babel-loader": "^9.2.1",
    "ts-node": "^10.9.2",
    "typescript": "^5.6.2",
    "vitest": "^2.1.1",
    "zod": "^3.23.8"
  }

To Reproduce Steps to reproduce the behavior:

  1. Navigate to the e2e folder.
  2. Run the following command:
   npx vitest run exploration --testTimeout 1200000
  1. After the test execution, ensure that the allure-results folder is generated under the e2e directory.
  2. Run the following command within the e2e folder:
allure serve allure-results
  1. Observe that the dashboard data is not displayed as expected in the Allure report.

Expected behavior Description sections should display in every tests.

Screenshots The results of tests wrapped in test.concurrent() Screenshot 2024-09-26 at 7 30 06 PM The results of tests wrapped in test() Screenshot 2024-09-26 at 7 29 57 PM

Desktop (please complete the following information):

  • OS: [MAC OS 14.5]
  • Browser [chrome]
  • Version [Version 126.0.6478.127 (Official Build) (arm64)]

Additional context Add any other context about the problem here.

li1225 avatar Sep 26 '24 11:09 li1225