yarn test
yarn test
运行包定义的测试脚本。
yarn test
如果您在包中定义了一个scripts
对象,则此命令将运行指定的test
脚本。
例如,如果在你的包有一个bash脚本scripts/test
:
#!/bin/bash
echo "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 test
yarn test v0.15.1
$ "./scripts/test"
Hello, world!
✨ Done in 0.17s.
yarn run test
yarn test
也是一个yarn run test
的捷径。