Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see

yarn test

Runs the test script defined by the package.

yarn test

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

For example, if you have a bash script in your package, scripts/test:


echo "Hello, world!"

and the following in your package.json:

  "name": "my-tribute-package",
  "version": "1.0.0",
    "This is not the best package in the world, this is just a tribute.",
  "main": "index.js",
  "author": "Yarn Contributor",
  "license": "MIT",
  "scripts": {
    "test": "scripts/test"

then running yarn test would yield:

$ yarn test
yarn test v0.15.1
$ "./scripts/test"
Hello, world!
✨ Done in 0.17s.
yarn run test

yarn test is also a shortcut for yarn run test.