Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@buxlabs/testgen

0.3.2 • Public • Published

testgen

Codeship Status for buxlabs/testgen

Installation

npm install -g @buxlabs/testgen

Idea

Utility tool for generating test skeletons based on static code analysis.

It might be useful if:

  • you have a code generator and you'd like to add specs by default too,
  • the code you're working on is missing specs (e.g. a big single page app),
  • you'd like to enforce a policy of a spec per file and generate the spec skeleton for conveniance and cohesion

The lib was created for an AMD API based front-end app with jasmine specs, support for other module definitions will be added gradually, as per current needs. Contibutions are welcome.

Usage:

testgen --path=subapp/hello/view/layout.view > subapps/hello/view/layout.view.spec.js

Examples:

in

define([
    'core/view',
    'subapp/hello/template/layout'
], function (View, template) {
    'use strict';
 
    return View.extend({
        template: template
    });
 
});

out

import LayoutView from 'subapp/hello/view/layout.view';
 
describe('subapp/hello/view/layout.view', function () {
    it('should be defined', function () {
        expect(LayoutView).toBeDefined(); 
    });
});

todo

  • add: es6
  • add: coverage
  • add: more strict eslint rules
  • add: error handling for cases where we cannot generate a spec
  • add: generate specs for other runners (tap etc.)
  • add: UMD
  • add: CommonJS
  • add: docs
  • add: changelog

Keywords

none

Install

npm i @buxlabs/testgen

DownloadsWeekly Downloads

29

Version

0.3.2

License

MIT

Last publish

Collaborators

  • avatar
  • avatar