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

neutrino-preset-tape

v1.0.0

Published

Neutrino preset for testing Neutrino projects with tape

Downloads

5

Readme

Neutrino Tape Preset

NPM version NPM downloads

neutrino-preset-tape is a Neutrino preset that supports testing JavaScript projects with tape.

It is based on neutrino-preset-mocha.

Features

  • Zero upfront configuration necessary to start testing
  • Babel compilation that compiles your tests using the same Babel options used by your source code
  • Easily extensible to customize your testing as needed

Requirements

  • Node.js v6.9+
  • Yarn or npm client
  • Neutrino v5, Neutrino build preset

Installation

neutrino-preset-tape can be installed via the Yarn or npm clients. Inside your project, make sure neutrino and neutrino-preset-tape are development dependencies. You will also be using another Neutrino preset for building your application source code.

Yarn

❯ yarn add --dev neutrino-preset-tape

npm

❯ npm install --save-dev neutrino-preset-tape

Project Layout

neutrino-preset-tape follows the standard project layout specified by Neutrino. This means that by default all project test code should live in a directory named test in the root of the project. Test files end in _test.js or .test.js by default.

Quickstart

After adding the Tape preset to your Neutrino-built project, add a new directory named test in the root of the project, with a single JS file named simple_test.js in it.

❯ mkdir test && touch test/simple_test.js

Edit your test/simple_test.js file with the following:

import test from 'tape';

test('should be sane', t => {
  t.equal(true, !false);
  t.end();
});

Now edit your project's package.json to add commands for testing your application. In this example, let's pretend this is a Node.js project:

{
  "scripts": {
    "test": "neutrino test --use neutrino-preset-node neutrino-preset-tape"
  }
}

Or if you have set up Neutrino with neutrino.use in your package.json:

{
  "neutrino": {
    "use": [
      "neutrino-preset-node",
      "neutrino-preset-tape"
    ]
  }
}

Run the tests, and view the results in your console:

Yarn

❯ yarn test
TAP version 13
# should be sane
ok 1 should be equal

1..1
# tests 1
# pass  1

# ok

Done in 2.18s.

npm

❯ npm test
TAP version 13
# should be sane
ok 1 should be equal

1..1
# tests 1
# pass  1

# ok

Done in 2.18s.

To run tests against files from your source code, simply import them:

import thingToTest from '../src/thing';

For more details on specific tape usage, please refer to their documentation.

Executing single tests

By default this preset will execute every test file located in your test directory ending in _test.js. Use the command line files parameters to execute individual tests.

Customizing

To override the test configuration, start with the documentation on customization. neutrino-preset-tape creates some conventions to make overriding the configuration easier once you are ready to make changes.

Rules

The following is a list of rules and their identifiers which can be overridden:

  • compile: Compiles JS files from the test directory using Babel. Contains a single loader named babel. Adopts Babel configuration from other presets that have been loaded.

Simple customization

By following the customization guide you can override and augment the test configuration directly from package.json. neutrino-preset-tape will import Tape configuration from your package.json's neutrino.options.tape object if defined.

Contributing

This preset is can be found in the repo https://github.com/allain/neutrino-preset-tape repository.