jest-community / vscode-jest

The optimal flow for Jest based testing in VS Code
MIT License
2.84k stars 295 forks source link

Single test regex semantic error (maybe) #1084

Closed dbwodlf3 closed 1 year ago

dbwodlf3 commented 1 year ago

Environment

  1. vscode-jest version: v6.0.1
  2. node -v: 16.0
  3. npm -v or yarn --version: npm 8.5.5
  4. npm ls jest or npm ls react-scripts (if you haven’t ejected): jest@29.5.0, ts-jest@29.1.0
  5. your vscode-jest settings if customized:
    • jest.jestCommandLine? : yes
    • jest.autoRun? : no
    • anything else that you think might be relevant? : no
    • i am using belows option
      "jest.virtualFolders": [
      {"name": "unit-tests", "jestCommandLine": "npm run test:unit --"},
      {"name": "e2e-tests", "jestCommandLine": "npm run test:e2e --"}
      ]
  6. Operating system: : mac

Prerequisite

[fill]

Relevant Debug Info

[fill]

Expected Behavior

i have 2 tests. ✓ should sign out (20 ms) ✓ should sign out with users real remote ip

but i would like to onoly works should sign out, but works two. and below is all command (can i check on jest terminal by extension) cross-env NODE_ENV=dev NODE_OPTIONS=--experimental-vm-modules npx jest --config jest-e2e.json --colors "--testLocationInResults" "--json" "--useStderr" "--outputFile" "/var/folders/nk/31mhwxz50_j2b2_s_pm0j2q00000gn/T/jest_runner_e2e_tests_501_2.json" "--testNamePattern" "User Signout API Test /api/user/sign-out should sign out" "--coverage" "--reporters" "default" "--reporters" "/Users/..../.vscode/extensions/orta.vscode-jest-6.0.1/out/reporter.js" "--colors" "--watchAll=false" "--testPathPattern" "/Users//..../Documents/...../src/auth/__test/user/signout/controller\.e2e-spec\.ts"

Here i can check, testNamePattern is not regex and just plain text. (--testNamePattern" "User Signout API Test /api/user/sign-out should sign out") the regex(/should sign out/) matchs to (should sign out with users real remote ip) and (should sign out).

i thinks the text should be like to "regex(/^should sign out$/"

Actual Behavior

[fill]


The fastest (and the most fun) way to resolve the issue is to submit a pull-request yourself. If you are interested, feel free to check out the contribution guide, we look forward to seeing your PR...

connectdotz commented 1 year ago

The testNamePattern passes the "full name", i.e. from the describe blocks all the way down to the test. we don't need the "^," but you are right that we could append a "$" to end the pattern.