rbst-lite v2016.10.10

Code coverage report for node-rbst-lite/test.js

Statements: 100% (28 / 28)      Branches: 100% (5 / 5)      Functions: 100% (6 / 6)      Lines: 100% (28 / 28)      Ignored: none     

All files » node-rbst-lite/ » test.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97                      1   1         1   1 1   1 1   1           1       1 1 3   1           1 1             3           1         1   1         1   1     1 1   1   1             1   1 1        
/* istanbul instrument in package rbst-lite */
/*jslint
    bitwise: true,
    browser: true,
    maxerr: 8,
    maxlen: 96,
    node: true,
    nomen: true,
    regexp: true,
    stupid: true
*/
(function () {
    'use strict';
    var local;
 
 
 
    // run node js-env code - pre-init
    (function () {
        // init local
        local = require('./index.js');
        local.modeJs = 'node';
        // require modules
        local.fs = require('fs');
        local.utility2 = require('utility2');
    }());
    switch (local.modeJs) {
 
 
 
    // run node js-env code - function
    case 'node':
        local.testCase_build_doc = function (options, onError) {
        /*
         * this function will test build's doc handling-behavior
         */
            options = {};
            local.utility2.onNext(options, function (error) {
                switch (options.modeNext) {
                case 1:
                    options.moduleDict = {
                        'rbst-lite': {
                            exampleList: [],
                            exports: local
                        }
                    };
                    Object.keys(options.moduleDict).forEach(function (key) {
                        options.moduleDict[key].example = [
                            'README.md',
                            'test.js',
                            'index.js'
                        ]
                            .concat(options.moduleDict[key].exampleList)
                            .map(function (file) {
                                return '\n\n\n\n\n\n\n\n' +
                                    local.fs.readFileSync(file, 'utf8') +
                                    '\n\n\n\n\n\n\n\n';
                            }).join('');
                    });
                    // create doc.api.html
                    local.utility2.fsWriteFileWithMkdirp(
                        local.utility2.envDict.npm_config_dir_build + '/doc.api.html',
                        local.utility2.docApiCreate(options),
                        options.onNext
                    );
                    break;
                case 2:
                    local.utility2.browserTest({
                        modeBrowserTest: 'screenCapture',
                        url: 'file://' + local.utility2.envDict.npm_config_dir_build +
                            '/doc.api.html'
                    }, options.onNext);
                    break;
                default:
                    onError(error);
                }
            });
            options.modeNext = 0;
            options.onNext();
        };
        break;
    }
    switch (local.modeJs) {
 
 
 
    /* istanbul ignore next */
    // run node js-env code - post-init
    case 'node':
        local.modeTest = 1;
        // run test-server
        local.utility2.testRun(local);
        break;
    }
}());