Vscode-jest: Feature - Run jest with specified node version from .nvmrc file

Created on 1 Feb 2017  路  9Comments  路  Source: jest-community/vscode-jest

Since the plugins starts without allowing the user to specify what version of node should be used, and use the default selected version in its own process, it is not yet possible to select what version of node should be used.

In my case, my default nvm node version is 4.x. But my project has a .nvmrc with 6.9.1 in it. But Jest uses the default one. _(which makes the whole extension unusable since it crashed instantly)_

Would it be possible to either specify what path of node we want Jest to use, or, more simply, run a nvm use before the plugin starts if there is a .nvmrc file in the root folder?

Most helpful comment

I know this issue is pretty old, is there a proposed solution or suggested workaround on how to get the watch test use the right node version using nvm?

For what it's worth, when using the debug launch lens, it uses the node version specified in in launch.json, so that works. But the watched test seems to not be using launch..?

All 9 comments

This seems reasonable to me, it'll have to go in jest-editor-support ( which has just had some changes related to this https://github.com/facebook/jest/pull/2817 )

Definitely needed, current node version management seems difficult.

Also please update README that to change node version for tests one has to do
nvm alias default $REQUIRED_NODE_VERSION

PRs welcome 馃憤

I know this issue is pretty old, is there a proposed solution or suggested workaround on how to get the watch test use the right node version using nvm?

For what it's worth, when using the debug launch lens, it uses the node version specified in in launch.json, so that works. But the watched test seems to not be using launch..?

For what it's worth, when using the debug launch lens, it uses the node version specified in in launch.json, so that works. But the watched test seems to not be using launch..?

Same. @orta how do I get jest in watch mode to use the node version specified in launch.json?

I am also looking for a solution to use this plugin with nvm...

same here, watch not working

During debugging, this extension uses vscode's debug infrastructure that used launch.json; during the regular test run/watch it spawns a node process instead. It would default to the node version from your default shell... I use nvm and it works fine. Do you guys actually want to use a different node version than your default nvm?

During debugging, this extension uses vscode's debug infrastructure that used launch.json; during the regular test run/watch it spawns a node process instead. It would default to the node version from your default shell... I use nvm and it works fine. Do you guys actually want to use a different node version than your default nvm?

Yes, I'd want to use the version specified in the .nvmrc file, not the shell default.

Was this page helpful?
0 / 5 - 0 ratings