pnpm exec

    is added to the PATH, so pnpm exec allows executing commands of dependencies.

    If you have Jest as a dependency of your project, there is no need to install Jest globally, just run it with pnpm exec:

    The exec part is actually optional when the command is not in conflict with a builtin pnpm command, so you may also just run:

    1. pnpm jest

    Options

    Any options for the command should be listed before the exec keyword. Options listed after the exec keyword are passed to the executed command.

    Bad, pnpm will not run recursively but jest will be executed with the -r option:

    1. pnpm exec jest -r

    Execute the shell command in every project of the workspace.

    The name of the current package is available through the environment variable .

    Examples

    Prune node_modules installations for all packages:

    1. pnpm -rc exec pnpm view $PNPM_PACKAGE_NAME

    Added in: v7.22.0

    Resume execution from a particular project. This can be useful if you are working with a large workspace and you want to restart a build at a particular project without running through all of the projects that precede it in the build order.

    Completely disregard concurrency and topological sorting, running a given script immediately in all matching packages with prefixed streaming output. This is the preferred flag for long-running processes over many packages, for instance, a lengthy build process.

    Runs the command inside of a shell. Uses /bin/sh on UNIX and on Windows.