deno_std icon indicating copy to clipboard operation
deno_std copied to clipboard

fix(testing/bdd): fix cases where `only` keyword skips tests that should run

Open pting-me opened this issue 2 years ago • 3 comments

Fixes #2979

There seems to be unexpected behavior when using test suites with describe.only.

The file only_test.ts will not be committed. I'm using it to demonstrate which tests I believe should be running, but are not. There are still some edge cases which don't seem to be working properly, and I have documented.

If someone could please verify that the cases I laid out in only_test.ts are correctly marked as "Should run", I'll start writing tests for those cases.

pting-me avatar Jan 02 '23 18:01 pting-me

The expectations in only_test.ts looks good to me, but let's not consider flat test grouping nested inside other suites like the below:

describe("outer 2.2", () => {
  describe(onlyTests, "inner 2.2.1", () => {
    /**
     * Should run
     * Fixed
     */
    it("it 2.2.1", () => {
      assertEquals(0, 0);
    });
  });
});

I don't think we support this situation

kt3k avatar Jan 04 '23 10:01 kt3k

The expectations in only_test.ts looks good to me, but let's not consider flat test grouping nested inside other suites like the below:

The specific one you mentioned is actually fixed, although I can remove it if you prefer. There are three cases in the file marked "Bugged." I will make notes on them.

pting-me avatar Jan 06 '23 14:01 pting-me

Added snapshot test case to check the output of the given example.

Now the below existing test cases are failing:

global ... describe ... only ... signature 1 ... all options => ./testing/bdd_test.ts:954:17
global ... describe ... only ... signature 3 ... all options => ./testing/bdd_test.ts:994:17
global ... describe ... only ... signature 4 => ./testing/bdd_test.ts:1010:15
global ... describe ... only ... signature 5 => ./testing/bdd_test.ts:1022:15
global ... describe ... only ... signature 6 ... minimum options => ./testing/bdd_test.ts:1035:17
global ... describe ... only ... signature 6 ... all options => ./testing/bdd_test.ts:1047:17
global ... describe ... only ... signature 7 ... minimum options => ./testing/bdd_test.ts:1063:17
global ... describe ... only ... signature 7 ... all options => ./testing/bdd_test.ts:1075:17
global ... describe ... only ... signature 8 ... minimum options => ./testing/bdd_test.ts:1092:17
global ... describe ... only ... signature 8 ... all options => ./testing/bdd_test.ts:1104:17

@pting-me Do you have any idea what is going wrong?

kt3k avatar Dec 18 '23 07:12 kt3k

Gentle ping, @pting-me.

iuioiua avatar Feb 07 '24 01:02 iuioiua

Closing as it is stale now. Let's revisit when someone start complaining about this

kt3k avatar Apr 17 '24 06:04 kt3k