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

browserify-test

v3.1.0

Published

Test front-end libraries using browserify and mocha with ease

Downloads

26

Readme

browserify-test

Simplify testing of front-end libraries using browserify and mocha

Features:

  • No config files, just run your tests in terminal with phantomjs or start watch server to test and debug in actual browser;
  • It builds on top of testem for solid integration with different browsers and platforms;
  • It uses watchify and errorify for better development experience;

Usage

Install with npm and make sure phantomjs is installed (phantomjs -v):

npm install --global browserify-test

Pass test files to browserify-test and enjoy browserified mocha tests:

browserify-test --help

  Usage: browserify-test [options] [./test/*.js ...]

  Options:

    -h, --help                  output usage information
    -V, --version               output the version number
    -w, --watch                 run watch server on http://localhost:7357
    -t, --transform <t1,t2,..>  add browserify transforms
    -p, --plugins <p1,p2,..>    add browserify plugins
    -b, --browserifyOptions <jsonStringifiedObj>     add browserifyOptions
    --testem, --testemOptions <jsonStringifiedObj>   add testemOptions

browserify-test # run tests for ./test/*.js
browserify-test --watch # start watch server on localhost:7537
browserify-test ./path/to/test.js ./path/to/another-test.js # pass test files as arguments
browserify-test ./lib/**/test.js # use globs
browserify-test --transform [ babelify --presets es2015 ] ./path/to/es6-test.js # use transforms

Integration with npm

Add browserify-test to your development dependencies:

npm install --save-dev browserify-test

And use npm scripts to run your tests in terminal with npm test or start development watch server with npm start.

{
  "scripts": {
    "test": "browserify-test ./test/index.js",
    "start": "browserify-test --watch ./test/index.js"
  },
  "devDependencies": {
    "browserify-test": "^2.1.2"
  }
}

npm hint: you don't need to type ./node_modules/.bin/browserify-test to refer on local copy of browserify-test, npm does it automatically.

Node.js

import run from 'browserify-test'

run({
  watch: false,
  transform: ['brsf', ['babelify', { presets: 'es2015' }]],
  files: ['./test/file1.js', './test/file2.js'],
})

Options

  • files (or entries) - Array - a list of files for browserify
  • watch - Boolean - enable watch server
  • transform (or transforms) - Array - a list of browserify transform modules
  • plugins - Array - a list of browserify transform modules
  • browserifyOptions - Object - options to pass as browserify options
  • testemOptions - Object - options to pass as testem options. Note that besides config-level options, the CLI-level options are also available, as are Testem's hooks which can be used to report on testem phases); these can be expressed as strings (to execute shell commands) or as callbacks. Callbacks will be passed the Testem config object, any data object for the hook (only currently used for the undocumented on_change hook, providing a file path property), and a callback which should be invoked with a falsy argument (or no arguments) to indicate a passed Testem test or invoked with a truthy argument (such as an error object) to report a failed Testem test.
  • finalizer - Function called toward end of tests; as in testem, this finalizer will be passed an exit code (set to 0 if normal and 1 if erring) and any (Bluebird) error object. If you wish to execute code prior to the end of all tests, see the docs above on hooks in testemOptions.

License

MIT