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 🙏

© 2026 – Pkg Stats / Ryan Hefner

mini-testbridge

v1.1.0

Published

A lightweight testing bridge for WeChat Mini Programs

Readme

Mini TestBridge

一个轻量级的微信小程序测试桥接工具,帮助开发者更方便地进行小程序自动化测试。

特性

  • 🚀 轻量级,无依赖
  • 📱 支持微信小程序
  • 🔧 简单易用的 API
  • 🎯 支持元素查找和操作
  • ⚡ 异步操作支持
  • 📝 完整的 TypeScript 支持

安装

npm install mini-testbridge

TypeScript 支持

本库提供完整的 TypeScript 类型定义,无需额外安装 @types 包。

import { register, tap, input, run, TestElement } from 'mini-testbridge'

// 类型安全的元素注册
const element: TestElement = {
  tap: () => console.log('clicked'),
  input: (value: string) => console.log('input:', value)
}

register('my-element', element)

发布流程

本项目使用 GitHub Actions 自动发布到 npmjs.com。

自动发布

  1. 推送代码到主分支会触发 CI 测试
  2. 创建新的 Release 会自动发布到 npmjs.com

手动发布步骤

  1. 更新 package.json 中的版本号
  2. 提交并推送代码
  3. 在 GitHub 上创建新的 Release
  4. GitHub Actions 会自动构建并发布包

安装已发布的包

npm install mini-testbridge

快速开始

在小程序中使用

// app.js
const testBridge = require('mini-testbridge')

App({
  onLaunch() {
    wx.testBridge = testBridge
    console.log('Test Bridge ready', testBridge)
  }
})

基本用法

// 在页面中使用
const { register, tap, input, run } = require('mini-testbridge')

Page({
  onLoad() {
    // 注册页面元素
    register('login-btn', {
      tap: () => {
        console.log('点击了登录')
        // 执行登录逻辑
      }
    })

    register('phone-input', {
      input: (value) => {
        this.setData({ phone: value })
        console.log('输入手机号:', value)
      }
    })

    register('submit-btn', {
      tap: () => {
        console.log('提交成功')
        this.setData({ success: true })
      }
    })
  },

  data: {
    phone: '',
    success: false
  }
})

// 执行测试步骤
await run([
  () => input('phone-input', '13800138000'),
  () => tap('login-btn'),
  () => tap('submit-btn')
])

API 文档

Registry API

register(id, node)

注册页面元素

  • id - 元素标识符
  • node - 元素对象,需包含 tap()input(value) 方法

get(id)

获取已注册的元素

getAll()

获取所有已注册的元素

Action API

tap(id)

点击元素

input(id, value)

输入文本

Runner API

run(steps)

执行测试步骤序列

runNoReturn(steps)

执行测试步骤序列(无返回值)

贡献

欢迎提交 Issue 和 Pull Request!

许可证

MIT