vscode-jest icon indicating copy to clipboard operation
vscode-jest copied to clipboard

feat: add support for pnpm round 2

Open robmcguinness opened this issue 1 year ago • 6 comments

Credit to original PR https://github.com/jest-community/vscode-jest/pull/1033. This includes unit tests.

  • Followed instructions for code --extensionDevelopmentPath=your-local-vscode-jest and seemed to work fine 🤞🏼
  • yarn test passed
  • yarn vscode:prepublish seemed to work

Closes #974

robmcguinness avatar Jul 09 '23 00:07 robmcguinness

Pull Request Test Coverage Report for Build 5497229823

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.001%) to 97.755%

Totals Coverage Status
Change from base Build 5492310856: 0.001%
Covered Lines: 3544
Relevant Lines: 3564

💛 - Coveralls

coveralls avatar Jul 23 '23 01:07 coveralls

@connectdotz seems like there is more work todo. I tried using plugin to generate default config for debugging. Here are the results with pnpm:

./node_modules/.bin/jest --runInBand --watchAll=false --testNamePattern "" --runTestsByPath "" 
Debugger attached.
Waiting for the debugger to disconnect...
[workspace root]/node_modules/.bin/jest:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1176:20)
    at Module._compile (node:internal/modules/cjs/loader:1218:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47

Reference article that had similar problem https://dev.to/elpddev/debug-jest-spec-in-vscode-error-missing-after-argument-list-1p3b

I'll try and dig further.

robmcguinness avatar Jul 27 '23 15:07 robmcguinness

Thanks for digging, a few thoughts:

  1. the --testNamePattern and --runTestsByPath are all blank, which doesn't seem right. The extension should fill the variables with the actual test and testFile names accordingly if the test config is properly named: vscode-jest-tests.v2, for example... you can take a look at the code here, which does the filling/replacing the variables above.
  2. If you save the default config to launch.json and replace the command with the one suggested by the link you posted above... did it work?

connectdotz avatar Jul 29 '23 17:07 connectdotz

@robmcguinness Thanks for the PR. It looks good.

Before we go ahead with this, just want to double-check that you have tested it with a pnpm project without the debug config in launch.json, and you were able to use the plugin to generate a default config to debug the test. That means you should see this message in the test terminal when you debug the test: No debug config named "vscode-jest-tests.v2" or "vscode-jest-tests" found in launch.json, will use a default config.

Hi @connectdotz, it's been a while. Let me know if you'd want to write a test for this. I've recently used the WebdriverIO VS Code Testing Service to test another extension and could set that up pretty quickly (in a separate Issue and PR).

seanpoulter avatar Mar 02 '24 20:03 seanpoulter

@seanpoulter, nice to see you here! 😃

I dropped the ball on this issue, it would be great if you could test this against a pnpm workspace! Thanks!

connectdotz avatar Mar 05 '24 17:03 connectdotz

Sorry I have not been able to circle back on this.

robmcguinness avatar Mar 07 '24 01:03 robmcguinness