Raathigesh / majestic

⚡ Zero config GUI for Jest
MIT License
7.49k stars 173 forks source link

[Bug] Tests run inside arrow function are not listed and lacking names #220

Open barlots opened 3 years ago

barlots commented 3 years ago

Bug

Reproduction:

Test evaluated inside arrow function (in order to be used multiple times with different parameters) is sometimes detected by Majestic as one, nameless test entry in GUI, or not visible at all

// calc.test.ts
import { add } from "./calc";

const testAdd = (a: number, b: number, expected: number) => {
  test(`should '${a}' + '${b}' be '${expected}'`, () => {
    var result = add(a, b);
    expect(result).toBe(expected);
  });
};

testAdd(1, 1, 2);
testAdd(2, 2, 4);
testAdd(2, -1, 1);

// calc.ts
export function add(a: number, b: number): number {
  return a + b;
}

obraz