Giter Site home page Giter Site logo

generator-test's Introduction

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 algorthim-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 architechtures 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, A simple mocha/chai TDD scaffold for your algorithm solution with the following folder structure will be created:

solution
├── node_modules
│   └── chai
├── package.json
├── spec
│   └── algorithm.js
└── algorithm.js

After runnning 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

generator-test's People

Contributors

bttmly avatar o-klp avatar phillipalexander avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.