spec-master

Bootstrap test/spec files for JS.

Spec Master

Bootstrap test/spec files for JS/CS.

Developed for JavaScript/CoffeeScript projects organized in modules (AMD or CommonJS).

Usage

First, if you haven't already, please read the configuration section.

If no action is specified a list of the modules without specs is printed.

Use the -a option to generate specs for the modules that need then.

##Examples

spec_master -s confs/spec_master.json
6 modules need specs:
core/Father.view.js
core/List.view.js
core/functional.helpers.js
core/partials.js
core/project.js
core/string.utils.js
 
spec_master -s examples/settings.json -a
Creating missing 6 specs...
 
c:/Users/lfac/r/spec_master/examples/specs/core/Father.view.js
c:/Users/lfac/r/spec_master/examples/specs/core/project.js
c:/Users/lfac/r/spec_master/examples/specs/core/partials.js
c:/Users/lfac/r/spec_master/examples/specs/core/functional.helpers.js
c:/Users/lfac/r/spec_master/examples/specs/core/List.view.js
c:/Users/lfac/r/spec_master/examples/specs/core/string.utils.js
 

Configuration

Spec Master requires a configuration file to work. An example:

{
    "src_modules_path" : "modules",
    "src_specs_path" : "specs",
    "spec_template_path" : "spec_template.jstemplate",
    "sufixes_to_exclude" : ["emplate.js"]
}

The paths are relative to the configuration file.

By default Spec Master will look for a settings.json in the current folder and in src/main/scripts/spec_master/settings.json (its for Maven projects). You can also specify the path via the -s option.

The template is compiled using underscore. An example:

define([
    'chai',
    '<%= path %>'
], function (chai, <%= varName %>) {
    "use strict";
 
    /*global describe, before, after, beforeEach, afterEach, it, sinon */
 
    var expect = chai.expect;
 
    describe('<%= path %>', function () {
 
    });
});

Two variables are passed as the template data. varName is the recommended variable name for the module and path is its path inside src_modules_path.

License

(The MIT License)

Copyright (c) 2013 Luis Cardoso <luis.cardoso@feedzai.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.