'Pass arguments to “node” executable when running “yarn run”

node can be started with various options. Especially interesting is the --inspect flag:

node --inspect node_modules/.bin/jest some.spec.js

Is it possible to pass the --inspect flag somehow to yarn run? For example:

yarn run test --inspect some.spec.js 

There is a similar question for npm run, where it seems to be not possible.



Solution 1:[1]

Alternatively you can use npx and pass node arguments with a -n or --node-arg flagnpx -n=--inspect-brk jest

npx feels more intuitive when dealing with cli's or packages that alias commands.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1