grunt-createunit

Create unit testing files for QUnit and Nodeunit with one managed test.

Usage no npm install needed!

<script type="module">
  import gruntCreateunit from 'https://cdn.skypack.dev/grunt-createunit';
</script>

README

grunt-createunit

Build Status NPM Downloads NPM Version

Create Unit-test files with base tests for QUnit and Nodeunit ...

Getting Started

This plugin requires Grunt ~1.*

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-createunit --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-createunit');

This plugin was designed to work with Grunt 0.4.x. If you're still using grunt v0.3.x it's strongly recommended that you upgrade, but in case you can't please use v0.3.2.

Createunit task

Run this task with the grunt createunit command.

Task targets, files and options may be specified according to the grunt Configuring tasks guide.

Options

destination

Type: String

Path for write test files

template

Type: String

Template fiele for executing unit tests

run_sufix

Type: String Default: '_run.js'

test_sufix

Type: String Default: '_test.js'

Usage Examples

createunit: {
    nodeunit: {
        options: {
            destination: 'test_nodeunit',
            template: 'test_/template/nodeunit.tpl',
            // run_sufix: '_run.js',
            // test_sufix: '_test.js'
        },
        src: 'test_/*_test.js'
    },
    qunit: {
        options: {
            destination: 'test_qunit',
            template: 'test_/template/qunit.tpl',
            run_sufix: '_run.html',
            // test_sufix: '_test.js'
        },
        src: 'test_/*_test.js'
    }
}

Find more project examples:

Task submitted by Fabian Schmid

Links