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

kigo-bin

v1.0.0

Published

melot developer tool

Downloads

6

Readme

安装

$ cnpm i kigo-bin --save-dev

用法

Add melot-bin to package.json scripts:

{
  "scripts": {
    "test-local": "melot-bin test",
    "test": "npm run lint -- --fix && npm run test-local",
    "cov": "melot-bin cov",
    "lint": "eslint ."
  }
}

测试

使用 mocha 和co-mocha 运行测试 断言库采用 power-assert

$ melot-bin test [files] [options]
  • files 默认为 test/**/*.test.js
  • test/fixtures, test/node_modules 自动被排除在测试用例之外

自动加载 test/.setup.js

如果 test/.setup.js 存在 首先运行这个文件中的内容

test
  ├── .setup.js
  └── foo.test.js

options

可以传递 mocha的参数 例如:

  • --require require the given module
  • --grep only run tests matching
  • --timeout milliseconds, default to 30000
  • --full-trace display the full stack trace, default to false.
  • 更多参数 https://mochajs.org/#usage

环境变量

支持环境变量设置测试参数

设置TESTS 环境变量 指定测试文件 支持通配符

TESTS=test/a.test.js melot-bin test

设置 TEST_REPORTER 设置报告格式, 默认格式为 spec.

TEST_REPORTER=doc melot-bin test

设置 TEST_TIMEOUT 指定测试用例超时时间, 默认30*1000ms.

TEST_TIMEOUT=2000 melot-bin test

测试覆盖率统计

  • 行覆盖率(line coverage):是否每一行都执行了?

  • 函数覆盖率(function coverage):是否每个函数都调用了?

  • 分支覆盖率(branch coverage):是否每个if代码块都执行了?

  • 语句覆盖率(statement coverage):是否每个语句都执行了?

  • 使用 [istanbul] 作为测试工具

  • 内置了 nyc 来支持单元测试自动生成代码覆盖率报告

  • 运行 npm run cov 执行测试

  • 报告生成在 coverage/lcov-report/index.html

忽略指定文件

1 npm run cov -- --x=app/plugins/*

2 设置环境变量 COV_EXCLUDES 设置忽略测试的文件

$ COV_EXCLUDES="app/plugins/c*,app/autocreate/**" melot-bin cov

忽略某些代码

1 var object = parameter || /* istanbul ignore next */ {};

2 /* istanbul ignore if */ if (hardToReproduceError)) { return callback(hardToReproduceError); }

License

MIT

[mocha]: https://mochajs.org
[co-mocha]: https://npmjs.com/co-mocha
[glob]: https://github.com/isaacs/node-glob
[istanbul]: https://github.com/gotwarlost/istanbul
[intelli-espower-loader]: https://github.com/power-assert-js/intelli-espower-loader
[power-assert]: https://github.com/power-assert-js/power-assert
[common-bin]: https://github.com/node-modules/common-bin
[sinon]: http://sinonjs.org/releases/v3.2.1/