zaqqaz / jest-allure

Generate Allure Report for jest. Allure Report, a flexible lightweight multi-language test report tool with the possibility to add steps, attachments, parameters and so on.
MIT License
113 stars 38 forks source link

Unable to nest `describe` blocks correctly #86

Open monkpit opened 2 years ago

monkpit commented 2 years ago

When I write describe() within another describe() in order to create nested test suites, the title from one describe() gets concatenated with the title from the other describe(), and the test suites are displayed all in one level - no nesting.

const testMyFunc = (input) =>  describe(`with ${input}`, () => {
    it('blah', () => { /* ... */ });
    it('foo', () => { /* ... */ });
    it('bar', () => { /* ... */ });
  });

describe('myFunc', () => {
  ['1', '2', '3'].forEach(testMyFunc);
});

Within the generated Allure report, I have 3 separate myFunc top-level suites, but I only want 1.

I get something like this:
> myFunc with 1
  > blah
  > foo
  > bar
> myFunc with 2
  > blah
  > foo
  > bar
> myFunc with 3
  > blah
  > foo
  > bar

But I would like something like this (it works with other Allure reporters):
> myFunc
  > with 1
    > blah
    > foo
    > bar
  > with 2
    > blah
    > foo
    > bar
  > with 3
    > blah
    > foo
    > bar

I know this is possible with Allure, I have seen it work with other report generators. But I am having this issue specifically with jest-allure.

This similar issue was raised on the allure-js repo, but I think it may be more appropriate to file it here.

epszaw commented 11 months ago

Use the official integration for jest. More details can be found in the linked issue.