GithubHelp home page GithubHelp logo

jest-feishu-reporter's Introduction

jest-feishu-reporter

ci npm Size

将 Jest 的测试错误发送到飞书。

飞书自定义机器人使用说明: 如何在群组中使用机器人?

加群

安装

npm install -D jest-feishu-reporter
# 或者
yarn add -D jest-feishu-reporter

使用

jest.config.js 中配置:

module.exports = {
  reporters: [
    "default",
    // ... other reporters
    [
      "jest-feishu-reporter",
      {
        "token": "xxxxxx-xxxxxxx-xxxx-xxxx",
        "secret": "xxxxxxx",
      },
    ],
  ],
};

或者在 package.json 配置:

"jest": {
  "reporters": [
    "default",
    [
      "jest-feishu-reporter",
      {
        "token": "xxxxxx-xxxxxxx-xxxx-xxxx",
        "secret": "xxxxxxx"
      }
    ] 
  ]
}

package.json 中还可以单独配置:

"jest-feishu": {
  "token": "xxxxxx-xxxxxxx-xxxx-xxxx",
  "secret": "xxxxxxx"
}

配置说明

token

如何在群组中使用机器人?第二步可以获取机器人的 webhook 地址,格式如下:

​https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxxxxxxxxxxx​
                                             ^^^^^^^^^^^^^^^^^
                                                   token

token 就是 url 最后面的部分。

secret

飞书有 3 种安全模式,如果使用签名校验,则需要设置 secret

注意事项

对于公有仓库,还可以通过设置系统环境变量来进行配置。

  • JEST_FEISHU_TOKEN - 设置 token
  • JEST_FEISHU_SECRET - 设置 secret

使用:

JEST_FEISHU_TOKEN=xxxx-xxxx-xxx npm run test

Github Actions 配置:

- name: Test
  env:
    JEST_FEISHU_TOKEN: ${{ secrets.FEISHU_TOKEN }}
  run: yarn test

License

jest-feishu-reporter is released under the MIT License. See the bundled LICENSE file for details.

jest-feishu-reporter's People

Contributors

justjavac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.