Skip to content

[Feature]: Custom test suite grouping #14762

Closed as not planned
Closed as not planned
@sergeyzwezdin

Description

🚀 Feature Proposal

Add ability to group test suites not by file, but be describe name.

Motivation

If you have a lot of tests for the same module, the test file is going to be cumbersome.
To keep tests clean and easy to read it would be great to split them into separate files, but give it the same name in describe section.
I've tried this approach and I like this approach of tests organization, but the problem is that now every file threats as individual test case which is very inconvenient.
Since jest is a platform why not to give option to group test suites with some custom logic?

Example

format-file.test-case1.test.ts:

describe('formatFile, () => {
  it('test case 1', () => {
  });
});

format-file.test-case2.test.ts:

describe('formatFile, () => {
  it('test case 2', () => {
  });
});

orgranize-imports.test-case1.test.ts:

describe('organizeImports', () => {
  it('test case 1', () => {
  });
});

So the test suite structure is:

  • formatFile
    • test case 1
    • test case 2
  • organizeImports
    • test case 1

Pitch

It is core functionality that seems could not be resolved via existing extension points. So would be great to have your input here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions