- yarn test
- yarn run test
运行包定义的测试脚本。
yarn test
如果你的包里有一个定义好的 scripts 对象,这个命令会运行指定的 test 脚本。
例如,如果你的包里有一个 bash 脚本 scripts/test:
#!/bin/bashecho "Hello, world!"
并且下面是你 package.json 里的:
{"name": "my-tribute-package","version": "1.0.0","description":"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"}}
那么运行 yarn test 将得到:
$ yarn testyarn test v0.15.1$ "./scripts/test"Hello, world!✨ Done in 0.17s.
yarn run test
yarn test 也是 yarn run test 的快捷命令。
原文: https://yarnpkg.com/zh-Hans/docs/cli/test
