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

united-tests

v1.0.6

Published

This is a tool that can automate and validate unit tests.

Downloads

11

Readme

united-tests

This is a tool that can automate and validate unit tests.

Why use them?

Because this is a lightweight and powerful unit test gadget, and we will continue to maintain it in the future.

Download

Download with npm

sudo npm install united-tests -g

Download with yarn

sudo yarn add united-tests -g

Usage

unitedt [options]

Flags

  • -h, --help: output usage information
  • -V, --version: output the version number
  • -e, --error: show detailed error message when got error
  • -o, --out: open test-out flag
  • -f, --fuzzy: Open fuzzy query (the fuzzy mode is in the form of regular expression)
  • -i, --info [filename]: Set the out info json file (default: "tests-info.json")
  • -j, --json [filename]: Set the entry json file (default: "tests.json")

Example

tests.json

{
  "test-out": false,
  "tests": [
    {
      "name": "hello",
      "run": {
        "inputs": [
          []
        ],
        "outputs": [
          "Hello world!"
        ]
      }
    }
  ]
}
unitedt

Edit tests.json

Basic structure

{
  "test-out": "boolean (default: false)",
  "out-in-json": "boolean (default: false)",
  "fuzzy": "boolean (default: false)",
  "out-json-name": "string (default: \"tests-info.json\")",
  "read-dir": "string (default: \"tests\")",
  "tests": "array"
}

Prototypes

  • test-out Set whether to output the result of the test module
  • out-in-json Set whether to output the test results and summary to the json file
  • out-json-name Set json filename
  • fuzzy Whether to enable fuzzy query (the fuzzy mode is in the form of regular expression)
  • read-dir Set the path to the unit test summary
  • tests Set up each module that the unit test needs to test and its input and output samples

Element of tests

{
  "name": "string",
  "run": {
    "inputs": "array",
    "outputs": "array"
  }
}

Issues

Issues-1

internal/modules/cjs/loader.js:611
    throw err;
    ^

Error: Cannot find module 'commander'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:609:15)
    at Function.Module._load (internal/modules/cjs/loader.js:535:25)
    at Module.require (internal/modules/cjs/loader.js:663:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/united-tests/bin/main.js:2:15)
    at Module._compile (internal/modules/cjs/loader.js:734:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:745:10)
    at Module.load (internal/modules/cjs/loader.js:626:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:566:12)
    at Function.Module._load (internal/modules/cjs/loader.js:558:3)

This shows that the command line tool is missing the npm package commander. Enter sudo npm install commander -g on the command line to solve

Issues-2

       throw err;
       ^
   
   Error: Cannot find module 'chalk'
       at Function.Module._resolveFilename (internal/modules/cjs/loader.js:609:15)
       at Function.Module._load (internal/modules/cjs/loader.js:535:25)
       at Module.require (internal/modules/cjs/loader.js:663:17)
       at require (internal/modules/cjs/helpers.js:20:18)
       at Object.<anonymous> (/usr/local/lib/node_modules/united-tests/bin/main.js:3:15)
       at Module._compile (internal/modules/cjs/loader.js:734:30)
       at Object.Module._extensions..js (internal/modules/cjs/loader.js:745:10)
       at Module.load (internal/modules/cjs/loader.js:626:32)
       at tryModuleLoad (internal/modules/cjs/loader.js:566:12)
       at Function.Module._load (internal/modules/cjs/loader.js:558:3)

This shows that the command line tool is missing the npm package chalk. Enter sudo npm install chalk -g on the command line to solve

License

MIT