RESOLVED: vscode-jest env: node: No such file or directory
すべてはここ:
https://github.com/jest-community/vscode-jest/issues/741#issuecomment-921222851
環境:
vscode-jest: v4.6.0
だいたいは、vscode-jest から起動される jest.jestCommandLine の設定が、デフォルトで /bin/sh からspawnされるために、nodenv とか使ってるとパスが通ってなくて落ちる。
解決方法はいくつかあるが、jest.shell を /bin/zsh など使ってるシェルに設定して、.zshenv で初期化させてあげる方法を取った。envを汚したくない気持ちはあったけれど、まあ事故らないかなという判断。
code:.zshenv
eval "$(/opt/homebrew/bin/brew shellenv)"
eval "$(nodenv init -)"
まだ未リリースの仕様だが、このPRで jest.shell が更に拡張されて引数も取れるようになるみたいなので、{ "path": "/bin/zsh", args: ["--login"] } でログインシェルから起動すれば .zshrc のままでもいけそう。
https://github.com/jest-community/vscode-jest/pull/874
#tech #web