npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@esydoc/resolver-qa

v2.1.3

Published

A resolver for qa code

Downloads

204

Readme

@esydoc/resolver-qa

一个解析Api源码生成QA代码的解析器

Installation

npm i @esydoc/resolver-qa -D

Usage

esydoc.config.js文件中的resolves字段添加@esydoc/resolver-qa对应的配置就ok拉。

// for example in esydoc.config.js
{
  resolves: {
    '@esydoc/resolver-qa': {
      pathPrefix: 'global.hyExt',
      output: {
        template: "hyext-qa-miniapp",
        dist: path.join(__dirname, "qa-effect-miniapp"),
        hostContext: {
          mocha: { timeout: 8 * 1000 },
          projectName: "qa-effect",
        },
      }
    },
  }
}

Esydoc Extra Config

pathPrefix

调用路径前缀,例如:pathPrefix为'global.hyExt', 原路径为’advance.getTid()‘拼接后'global.hyExt.advance.getTid()'。

{
  resolves: {
    '@esydoc/resolver-qa': {
      pathPrefix: 'global.hyExt',
    },
  }
}

hostContext

hostContext会注入到生成的代码之中,被用于项目运行时。

参数

| Name | Type | Required | Default | Description | | ----------- | ----------- | -------- | ------------- | -------------------------------------------------- | | mocha | MochaConfig | false | void | mocha 配置对象,点这里 | | projectName | string | false | 'qa 默认项目' | 生成项目的名字

{
  resolves: {
    '@esydoc/resolver-qa': {
      output: {
        hostContext: {
          mocha: { timeout: 8 * 1000 },
          projectName: "qa-effect",
        },
      }
    },
  }
}

API配置文件对应配置

API配置文件对应配置通过源码的注释节点生成,用于配置接口的置顶行为,例如函数调用相关的数据配置。

配置

  • deps: string[],依赖队列,是一个一维数据,某些 api 需依赖其他优先执行,例如:SDK.removeListener 需要 SDK.addListener 先执行后再执行。

  • args: Array, 函数参数队列,是一个二维数据,每个成员代表一个 arguments 或者是一个返回 arguments 的函数,函数的参数从 deps 中获取。

  • onDone?: (e: Error | undefined, next: (e: Error | undefined) => void)=> void, 自定义控制断言结果的 hook, 传入 2 个参数,第一个是接口在测试用例中抛出的错误对象,第二个测试用例消费函数,若在 next 函数中传入错误对象,则代表该测试用例不通过,反之通过。

DEMO

以 advance.sendGift.js 为例子:

module.exports = {
  deps: ['context.getGiftConf'], // getGiftConf优先执行,输出礼物配置数据
  args: [
    // 第一次调用, 默认送一个虎粮
    giftConfQueue => {
      return [
        {
          giftCount: 1,
          giftId: 4
        }
      ]
    },
    // 第二次调用,送一个礼物列表中的一个礼物
    giftConfQueue => {
      const giftConf = giftConfQueue[11]

      return [
        {
          giftCount: 1,
          giftId: giftConf.giftId
        }
      ]
    },
    // 第三次调用,送一个虎粮 - giftId:4
    [
      {
        giftCount: 1,
        giftId: 4
      }
    ]
  ],
  onDone: (e, next) => {
    if (e) {
      // 有些时候,SDK接口抛出的错误
      if (e.message.includes('不能送自己礼物')) {
        next()
      } else {
        next(e)
      }
    } else {
      next()
    }
  }
}

TODO

目前断言的类型只有type equal是远远不够的,之后会将断言部分做成插件的形式,注入到esydoc中, 为定制化的断言做好准

内置模板

  • hyext-qa-miniapp - QA虎牙小程序模板

TODO

目前断言的类型只有 type equal 是远远不够的,之后会将断言部分做成插件的形式,注入到 esydoc 中, 为定制化的断言做好准备

后台

地址 - http://esydoc.huya.info/qa-list