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
265 stars 124 forks source link

int-spec and manual-spec patterns not detected #153

Closed mnlbox closed 3 years ago

mnlbox commented 3 years ago

Hi and thanks for this awesome extention.

I changed the matching patter of this extention in option page to the bellow value to suppert int-spec and manual-spec for my integration and manual tests:

**/*.{test,spec,int-spec,manual-spec}.{js,jsx,ts,tsx}

But it's still not detected files like TestResolver.int-spec.ts and TestResolver.manual-spec.ts Do I missed anything? :thinking:

firsttris commented 3 years ago

if jest finds your test from commandline there should be no difference if this addon executes jest.

mnlbox commented 3 years ago

@firsttris Thanks for your quick reply. I have this jest.config.js file in the root of my project and jest can detect my test correctly. But I can't see any RUN | DEBUG button in my test file:

module.exports = {
  'moduleFileExtensions': [ 'js', 'ts', 'json' ],
  'roots': [
    '<rootDir>/src'
  ],
  'setupFiles': ['reflect-metadata', 'dotenv/config'],
  'setupFilesAfterEnv': ['jest-extended'],
  'testEnvironment': 'node',
  'testRegex': '.*\\.(int-|manual-)?spec\\.ts$',
  'transform': {
    '^.+\\.ts$': 'ts-jest'
  }
}
firsttris commented 3 years ago

ah now i got your point.

have you tried the "jestrunner.codeLensSelector" option in the vscode settings?

firsttris commented 3 years ago

here we pass this selector: https://github.com/firsttris/vscode-jest-runner/blob/master/src/extension.ts#L36

the pattern is a GlobPattern, just checked the documentation: https://code.visualstudio.com/api/references/vscode-api#GlobPattern

mnlbox commented 3 years ago

Yeah as I told I set this value for "jestrunner.codeLensSelector" in extention option page but it's still not working:

**/*.{test,spec,int-spec,manual-spec}.{js,jsx,ts,tsx}

So I think maybe the issue is related to this - character inside int-spec and manual-spec maybe I need to scape this character :thinking:

mnlbox commented 3 years ago

It's intresting, both of my files mached based on above glob pattern but it's not mached with extention :thinking: This is my pattern and tests: https://www.digitalocean.com/community/tools/glob?comments=true&glob=%2A%2A%2F%2A.%7Btest%2Cspec%2Cint-spec%2Cmanual-spec%7D.%7Bjs%2Cjsx%2Cts%2Ctsx%7D&matches=false&tests=src%2Fhello%2FTestResolver.int-spec.ts&tests=%2Fhello%2FTestResolver.manual-spec.ts&tests=%2F%2F%20This%20won%27t%20match%21&tests=%2Ftest%2Fsome%2Fglobs

firsttris commented 3 years ago

wired.

there is not much code releated to this. just initialize the codeLensProvider with this globPattern.

the default globPattern seem works: */.{test,spec}.{js,jsx,ts,tsx}

the only thing different seems to be the -

firsttris commented 3 years ago

have you tried

*/.{test,spec,*spec}.{js,jsx,ts,tsx}

firsttris commented 3 years ago

any success?

mnlbox commented 3 years ago

Hi @firsttris Sorry for the late response. No, I checked your suggestion and also some other setting but it seems it's not checking my globPattern at all :cry: