neotest-jest
neotest-jest copied to clipboard
No tests matched when we run on specific test
I noticed the behavior of parser to discover the position of test only supports a string in describe(string)
. It will not work if we have the real class name like this example below:
describe(Calculator, () => { // <---- will not match
it("sum a and b", () => { // <---- run the nearest test
expect(new Calculator().sum(1, 2)).toEqual(3);
});
});
describe("Calculator", () => { // <---- works
it("sum a and b", () => { // <---- run the nearest test
expect(new Calculator().sum(1, 2)).toEqual(3);
});
});
It seems if the test or suite name isn't a singly or doubly quoted string, test detection does not work for that test/suite. Template literals and class/function references cause this issue.
I've also noticed this same issue in neotest-vitest - which seems to be based on neotest-jest.