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

bz-generator-test

v2.0.2

Published

Yeoman based generator that creates a simple mocha/chai TDD scaffold for solving algorithms

Downloads

3

Readme

generator-test Circle CI

A simple generator for Yeoman that makes it easy to start writing unit tests and use Test Driven Development (TDD) while you karate-chop your way through algorithm-based programming challenges.

Introduction

What's Yeoman?

From wikipedia:

Yeoman is an open source client-side development stack, consisting of tools and frameworks intended to help developers quickly build high quality web applications. Yeoman runs as a command-line interface written in Node.js which combines several functions into one place, such as generating a starter template, managing dependencies, running unit tests, providing a local development server, and optimizing production code for deployment.

Generators

After installing Yeoman, you'll use generators to scaffold out specific types of applications. A generator is basically a plugin that can be run with the yo command to scaffold complete projects or useful parts. Examining the architectures that popular (well-built) generators produce is a fantastic way to learn how well-established software engineers think about structuring their applications. There are generators that help you scaffold out applications built in Angular, Backbone, as Chrome Extentions, and pretty much anything else you can imagine.

Installation

Yeoman

Install Yeoman with,

$ npm install -g yo

Generator-Test

Then install generator-test from npm:

$ npm install -g generator-test

cd to (or create) your project directory, then initiate the generator:

$ yo test

Usage

When invoked, this generator gives the option of creating a testing scaffold designed to be run in the browser, or one designed to be run with Node.

Browser

If you select 'browser' when prompted, A simple mocha/chai TDD scaffold for your algorithm solution with the following folder structure will be created:

solution
├── bower.json
├── bower_components
│   ├── chai
│   └── mocha
├── index.html
├── spec
│   └── algorithm.js
└── algorithm.js

After runnning the generator in browser mode, run the tests by opening index.html.

Node

If you select 'Node' when prompted, you will be prompted to choose the assert style to use: expect or should. A simple mocha/{chai.expect|should.js} TDD scaffold for your algorithm solution with the following folder structure will be created:

solution
├── node_modules
│   └── {chai|should}
├── package.json
├── spec
│   └── algorithm.js
└── algorithm.js

After running the generator in Node mode, run the tests via npm test.

Wrapping Up

If the current working directory already contains any JavaScript files, then you'll be asked which of them you wish to write tests for. If there are no js files present, a starter file will be generated for you.

Write additional tests in the file created in the /spec dir, and your algorithm in the file in the current dir.

License

MIT License