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

tapidatcher

v0.1.0

Published

An easy way to intelligentally watch your tape tests

Downloads

2

Readme

Tapidatcher

JavaScript Style Guide

Tapidatcher uses chokidar to watch over source and test file systems, so you can run tests with tape while you write code!

Tape is included as a dependency, so you only need to use tapidatcher when running tests

Why?

I used Jest a little bit recently, and found that I did enjoy their test watcher setup quite a bit. I prefer to use tape for all my testing needs, but lacked this functionality, so I decided to take a stab at it myself!

Arguments

  • -v, --version: Display the current tapidatcher version
  • -h, --help: Displays some helpful text for the cli
  • -c, --config: Use a config json instead of arguments
    • Defaults to tapidatcher.json
    • Example: tapidatcher -c tapi.config.json
  • -t, --tests: The location of your tests folder (if one exists) this is passed directly to chokidar so any of the methods used in the string can be applied here
    • Example: tapidatcher -t tests
  • -a, --assume: Automatically assumes if a file changed is named index that it sould use the folder name of this file
    • Example: tapidatcher -a
  • -s, --src: The location of your src file (if needed) this is passed directly to chokidar so any of the methods used in the string can be applied here
    • Example: tapidatcher -s src
  • -r, --require: Tell tapidatcher to use requires with tape, similar to tape -r
    • Example: tapidatcher -r esm
    • If using more than one require value split them with commas -r 'esm,something'
  • -e, --ending: The file name ending used so tapidatcher can tell the difference between tests and source code
    • This is only required if you are using the -i argument
    • Defaults to .js if not set
    • Example: tapidatcher -e '.unit.js'
  • -p, --pipe: Tell tapidatcher the pipe command you want to run after tape runs
    • Example: tapidatcher -p 'tap-on -u'
    • If using more than one pipe value split them with commas -p 'tap-on -u,something -else'
  • -n, --env: Give a list of env setters to prepend to your test command
    • Example: tapidatcher -n 'FORCE_COLOR=1'
    • If using more than one env value split them with commas -n 'FORCE_COLOR=1,ENV=test'
  • -i, --initial: Tells tapidatcher to run the initial tests command
    • Example: tapidatcher -i 'npm t'
  • -x, --ignore: Files/folders you want tapidatcher to ignore
    • Example: tapidatcher -x 'example.unit.js'
    • If using more than one env value split them with commas -x 'example.unit.js,examples/ignored',

Important: You must at least provide a source argument to wath (-s, --src)

If you don't provide the tests argument (-t, --tests) then Tapidatcher will assume all of your tests are inline and watch accordingly

Usage

When searching for a test, tapidatcher will attempt to check if the file changed has a corrosponding test name, if the source file name is something like index.js and you have the --assume argument set, then tapidatcher will attempt to use the folder name of that file as the test name.

You can use tapidatcher with the arguments, or with a json config. My suggestion is, if you have a lot of ignores/requires/etc then you use the config setup. Argument exists for simple and quick runs

Tapiatcher can be used like any other cli tool

$ tapidatcher -a -s examples/basic/src -t examples/basic/tests -n 'FORCE_COLOR=1' -p 'tap-on -s' -e .spec.js

$ tapidatcher -i examples/inline -n 'FORCE_COLOR=1' -p 'tap-on' -e .spec.js

$ tapidatcher -s examples/inline -x 'tmp.spec.js,examples/basic' -n 'FORCE_COLOR=1' -p 'tap-on' -e .spec.js

Using a config.json

Optionally instead of arguments you can use a config json to pass your setup to tapidatcher instead

NOTE using a config will IGNORE arguments passed via cli, you should put all of the settings in your json

Config types:

  • tests: String
  • src: String
  • ending: String
  • ignore: String[]
  • assum: Boolean
  • pipe: String[]
  • initial: String
  • require: String[]
  • env: Object
    • { name<String>: value<Any> }

Example config:

{
  "tests": "examples/basic/src",
  "src": "examples/basic/src",
  "ending": ".spec.js",
  "ignore": ["example.unit.js", "examples/ignored"],
  "assume": true,
  "pipe": ["tap-on -s"],
  "initial": "npm t",
  "require": ["esm"],
  "env": {
    "FORCE_COLOR": 1
  }
}

Using package.json

Alternatively you can put your tapidatcher settings into your package.json under the tapidatcher key.

The layout is exactly the same as if you were using the config setup.

Example:

{
  "name": "basic",
  "version": "1.0.0",
  "scripts": {
    "test": ""
  },
  "tapidatcher": {
    "tests": "basic/src",
    "src": "basic/src",
    "ending": ".spec.js",
    "ignore": [
      "example.unit.js",
      "ignored"
    ],
    "assume": true,
    "pipe": [
      "tap-on -s"
    ],
    "initial": "npm run initial",
    "require": [
      "esm"
    ],
    "env": {
      "FORCE_COLOR": 1
    }
  }
}