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

Unable to nest `describe` blocks correctly

Open monkpit opened this issue 2 years ago • 1 comments

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.

monkpit avatar Sep 14 '22 16:09 monkpit

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

epszaw avatar Nov 23 '23 15:11 epszaw