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

@mpcore/test

v0.1.12

Published

Testing Library-style utilities for compiled WeChat mini-program artifacts

Readme

@mpcore/test

面向微信小程序编译产物的 runner 无关测试 API。它模拟微信宿主和逻辑 WXML 树,不创建浏览器 DOM。

const project = createTestProject({
  artifact: { projectPath: '/path/to/project' },
  host: createWxMock({
    request: { url: '/api/count', response: { data: { count: 1 } } },
  }),
})

const result = await project.renderComponent('components/counter/index', {
  properties: { value: 1 },
  slots: { default: '<text>计数器</text>' },
})

await result.user.tap(result.screen.getByRole('button', { name: '增加' }))

查询支持 text、role、test id、attribute、within()get/query/find/getAll/findAll 变体,并保留 $ / $$ 选择器逃生口。tap/input/change/blur/trigger 会等待同步更新和 microtask 稳定后刷新逻辑树。

未匹配的网络 mock 会抛错;未捕获运行时异常和 console.error 默认令测试失败。可通过 diagnostics() 断言 warning,负向 console 测试可显式设置 failOnConsoleError: false

@mpcore/test 为真实微信小程序编译产物提供页面和组件单测环境。它模拟微信宿主与逻辑 WXML 树,不提供浏览器 document 或 CSS layout。

import { artifactFromProject, createTestProject } from '@mpcore/test'

const project = createTestProject({
  artifact: artifactFromProject(process.cwd()),
})

const { screen, user } = await project.renderPage('/pages/index/index')
await user.tap(screen.getByRole('button', { name: '增加' }))
expect(screen.getByText('2')).toBeDefined()

await project.close()

组件测试通过内存宿主页挂载构建后的组件,不会修改小程序产物。