yarn run

Runs a defined package script.

yarn run [script]

If you have defined a scripts object in your package, this command will run the specified [script].

For example,

yarn run test

would run the script named test defined in your package.json.

yarn run

If you do not specify a script to the yarn run command, the run command will list all of the scripts available to run for a package.

Scripts in package.json

To add executable scripts to your package.json, use the scripts key.

For example, the following would provide a script named test in your package that would run the jest test framework on code in your package.

"scripts": {
  "test": "jest"

← Previous: yarn remove Next: yarn self-update