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

jtf

v1.6.2

Published

毫秒级的轻量测试工具

Downloads

33

Readme

JTF

如果你用过ava、tap,会发现它们的执行速度真的很慢。特别是ava慢的难以置信,且大量占用CPU,导致糟糕的开发体验。

tape性能还不错,但它依然是个半成品,需要自行扩充,而且必须使用end()方法来结束测试代码,这样做似乎显得有些多余。

特性

  • jtf本身非常轻量且高效。

  • 仅使用node.js内置的assert断言模块。

  • 使用ava测试代码风格,部分兼容ava测试代码。

  • 支持同步和异步两种模式,同步时序更利于调试,异步则执行速度更快。

  • 使用cluster主进程搭配一个或多个工作进程,master用于文件监听,worker执行测试文件。

示例

let test = require('jtf')

test('sync', t => {

   t.deepEqual({ a: 1 }, { a: 1 });

   t.equal(true, true);

})

test('async', async t => {

   t.equal(true, true);

   t.ok(true);

})

Install

npm install jtf -g

cli的使用

在项目根目录下通过cli执行全局变量jtf,无参数时会执行test目录下的所有.js测试文件。

可选参数

  • -v, --version 版本信息

  • -w, --watch 测试文件监听

  • -a, --async 异步执行测试代码

可选配置

在项目根目录package.json中添加配置项,可灵活控制测试文件的监听范围。

{
   "jtf":{
      "test": {
         "path": "test/",
         "exclude": ["helpers"]
      },
      "app": {
         "path": "app/"
      }
   }
}