Skip to content
This repository has been archived by the owner on Aug 28, 2022. It is now read-only.

Use describe names for the suite name #179

Open
VladimirCW opened this issue Apr 30, 2021 · 1 comment · May be fixed by #198
Open

Use describe names for the suite name #179

VladimirCW opened this issue Apr 30, 2021 · 1 comment · May be fixed by #198
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@VladimirCW
Copy link

VladimirCW commented Apr 30, 2021

I want to have possibility to use sub suites - so the full test name will contain the whole root suite names from the describe name

So for the following test 4 test should be created
For now it will be only 2 tests

describe('Root suite', () => {

  describe('Nested root suite 1', () => {
    it('first assert', async () => {
      expect(true).toEqual(true);
    });
  });

  it('second assert', async () => {
    expect(true).toEqual(true);
  });

  describe('Nested suite 2', () => {
    it('first assert', async () => {
      expect(true).toEqual(true);
    });

    it('second assert', async () => {
      expect(true).toEqual(false);
    });
  });
});
@VladimirCW VladimirCW added the enhancement New feature or request label Apr 30, 2021
@ryparker ryparker self-assigned this May 6, 2021
alexneo2003 added a commit to alexneo2003/jest-circus-allure-environment that referenced this issue Jun 10, 2021
@alexneo2003 alexneo2003 linked a pull request Jun 10, 2021 that will close this issue
@ryparker ryparker linked a pull request Jun 14, 2021 that will close this issue
@ryparker
Copy link
Owner

ryparker commented Jun 21, 2021

Hey @VladimirCW 👋🏻

Thanks for opening this feature request. I agree support for describe blocks would be great for the project. I'm currently preparing for a move to Seattle so my time will be limited for the next month. However if nobody else happens to open a PR for it, then I will do my best to get this in before September.

In the mean time I thought I'd leave some notes here on how this could be implemented:

One interesting way i've seen this implemented is in the Allure Jasmine library. They solve this by collecting the describe layers via Jasmine's suiteStarted and suiteDone hooks. The equivalent of this hook would be the start_describe_definition and finish_describe_definition jest environment events.

Something like this could allow us to detect wether the test is in fact wrapped in a describe block. Then we can collect the layers of describe block. Then once the finish_describe_definition is called for that block we would remove it from the collection. All while supporting nested describe blocks, and not effecting current implementation that supports tests without describe blocks.

@ryparker ryparker pinned this issue Jun 21, 2021
@ryparker ryparker added this to the V2.0 milestone Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants