eugene-manuilov / jest-runner-groups

A custom runner that allows to tag test files and run groups of tests with Jest.
MIT License
128 stars 14 forks source link

Override groups #22

Closed hananmalka closed 2 years ago

hananmalka commented 3 years ago

Hi, I can see there isn't an option to override groups. I think if different groups is declared in "describe" level and in "it" level, the most inner one should be the relevant. For example:

   /**
   * @group regression
   */
describe(This is the describe level, () => { 

   /**
   * @group sanity
   */
  it("This "it" has group different from the describe", async () => {
  });

  it("This "it" gets the group from the describe", async () => {
  });

});

Now, in case we would like to run only regression we will use the command: npm run COMMAND -- --group=regression --> Here "sanity" group won't run In case we would like to run only regression we will use the command: npm run COMMAND -- --group=sanity --> Here "sanity" group won't run

I know it's can be done by using the exclude, but I believe this way is better. WDYT?

eugene-manuilov commented 3 years ago

@hananmalka unfortunately, jest uses two different runners to find test files to test and to find tests in those files to run. This package is the runner which is responsible for finding files to test. Your suggestion relates to another runner and, unfortunately, out of scope for this package. This is the limitation of the jest framework :man_shrugging: