target.test = function()

in make.js [249:307]


target.test = function() {
    ensureTool('tsc', '--version', 'Version 3.2.2');
    ensureTool('mocha', '--version', '5.2.0');

    // run the tests
    var suiteType = options.suite || 'L0';
    function runTaskTests(taskName) {
        banner('Testing: ' + taskName);
        // find the tests
        var nodeVersion = options.node || getTaskNodeVersion(buildPath, taskName) + "";
        var pattern1 = path.join(buildPath, taskName, 'Tests', suiteType + '.js');
        var pattern2 = path.join(buildPath, 'Common', taskName, 'Tests', suiteType + '.js');

        var testsSpec = [];

        if (fs.existsSync(pattern1)) {
            testsSpec.push(pattern1);
        }
        if (fs.existsSync(pattern2)) {
            testsSpec.push(pattern2);
        }

        if (testsSpec.length == 0) {
            console.warn(`Unable to find tests using the following patterns: ${JSON.stringify([pattern1, pattern2])}`);
            return;
        }

        // setup the version of node to run the tests
        util.installNode(nodeVersion);

        run('mocha ' + testsSpec.join(' ') /*+ ' --reporter mocha-junit-reporter --reporter-options mochaFile=../testresults/test-results.xml'*/, /*inheritStreams:*/true);
    }

    if (options.task) {
        runTaskTests(options.task);
    } else {
        // Run tests for each task that exists
        taskList.forEach(function(taskName) {
            var taskPath = path.join(buildPath, taskName);
            if (fs.existsSync(taskPath)) {
                runTaskTests(taskName);
            }
        });

        banner('Running common library tests');
        var commonLibPattern = path.join(buildPath, 'Common', '*', 'Tests', suiteType + '.js');
        var specs = [];
        if (matchFind(commonLibPattern, buildPath).length > 0) {
            specs.push(commonLibPattern);
        }
        if (specs.length > 0) {
            // setup the version of node to run the tests
            util.installNode(options.node);
            run('mocha ' + specs.join(' ') /*+ ' --reporter mocha-junit-reporter --reporter-options mochaFile=../testresults/test-results.xml'*/, /*inheritStreams:*/true);
        } else {
            console.warn("No common library tests found");
        }
    }
}