首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

yarn test

运行包定义的测试脚本。

yarn test

如果您在包中定义了一个scripts对象,则此命令将运行指定的test脚本。

例如,如果在你的包有一个bash脚本scripts/test

代码语言:javascript
复制
#!/bin/bash

echo "Hello, world!"

并在你的package.json运行下面代码:

代码语言:javascript
复制
{
  "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会产生:

代码语言:javascript
复制
$ yarn test
yarn test v0.15.1
$ "./scripts/test"
Hello, world!
? Done in 0.17s.

yarn run test

yarn test也是一个yarn run test的捷径。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com