firsttris / vscode-jest-runner

Simple way to run or debug one or more tests from context menu, codelens or command plalette
https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner
MIT License
264 stars 124 forks source link

Debug Test skips tests using class name / prototype name as test name #299

Closed kb-ig closed 1 year ago

kb-ig commented 1 year ago

I tend to use the following when specifying the name of a class or class-function being tested:

However this extension seems to always skip debugging these tests

class MyClass {
  myFunction() {}
}

describe(MyClass.name, () => {
  describe(MyClass.prototype.myFunction.name, () => {
    it('Should be true', () => {
      expect(true).toBe(true);
    });
  });
});

The tests can be debugged successfully if we update the describe and it functions to use a string litteral instead, e.g:

class MyClass {
  myFunction() {}
}

describe('MyClass', () => {
  describe('myFunction', () => {
    it('Should be true', () => {
      expect(true).toBe(true);
    });
  });
});
labeled commented 1 year ago

+1 it also seems to skip the test even when you try to run it (not debugging) image image

If you look closely it looks like it's trying to find the wrong named test -t "FeederWipDrawerComponent FeederWipDrawerComponent\.prototype\.wipTrackBy should return wipId"

However if I make the top level describe just a string (and click the run on it) it will find all of them and run them correctly.