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

Extension does not work with `nushell` on macOS

Open shepherdjerred opened this issue 1 year ago • 1 comments

Environment

  1. vscode-jest version: v5.2.3
  2. node -v: v18.17.1
  3. npm -v or yarn --version: 9.6.7
  4. npm ls jest or npm ls react-scripts (if you haven’t ejected):
    @discord-plays-pokemon/[email protected] /Users/jerred/git/discord-plays-pokemon
    └─┬ @discord-plays-pokemon/[email protected] -> ./packages/backend
      └─┬ [email protected]
        └── [email protected]
    
  5. your vscode-jest settings if customized:
    "jest.jestCommandLine": "/Users/jerred/.local/share/rtx/installs/node/18.17.1/bin/npx jest",
    "jest.nodeEnv": {
        "node": "/Users/jerred/.local/share/rtx/installs/node/18.17.1/bin/node"
    },
    "jest.rootPath": "packages/backend/",
    "jest.shell": "/opt/homebrew/bin/nu"
    
  6. Operating system: macOS Sonoma 14.0

Prerequisite

  • are you able to run jest test from the command line? Yes
  • how do you run your tests from the command line? (for example: npm run test or node_modules/.bin/jest) npm run test or npx jest

Steps to Reproduce

Install nushell and configure Jest to use it

Relevant Debug Info

CleanShot 2023-09-15 at 13 19 10@2x

shepherdjerred avatar Sep 15 '23 20:09 shepherdjerred

looks like the extension encountered some shell env issues so it is trying to fall back to a login shell (hoping to resolve the env initialization errors.). There are a list of common shells the extension could auto-fallback to login-shell, but nushell is not one of them (see here)

To make a long story short, if this only happens occasionally, you can try to restart vscode or start vscode from a macOS terminal. If it happens often and you don't mind using login shell for running jest, you can try to set your shell to login shell:

for example, if nushell uses --login as the login shell flag:

"jest.shell": {
  "path": "/opt/homebrew/bin/nu"
  "args": ["--login"],
}

Let me know if that works.

connectdotz avatar Sep 16 '23 19:09 connectdotz

Thank you for getting back to me, @connectdotz

In the end I switched back to fish because I ran into too many problems with nushell. I do appreciate you looking into this issue.

shepherdjerred avatar May 17 '24 14:05 shepherdjerred