I am using the VSCode Jest extension.
One of the features it gives you, is running your tests in the IDE and giving inline error messages.
The error it is giving me here TypeError: this.children.flatMap is not a function
is the Jest tests running in the wrong node runtime - .flatMap
is included in versions of node >11.
When I run Jest from command line, I also get this error, which I've fixed by adding a .nvmrc
to my project, and using nvm to change the node version.
How do I tell Jest/VSCode to simillarly change its Node runtime?
code
command. But this is a little annoying as I typically start VScode with a taskbar shortcut.nvmrc
help? If yes could you add it as an answer?