How to use the karma/lib/preprocessor.createPreprocessor function in karma

To help you get started, we’ve selected a few karma examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nikku / karma-browserify / lib / preprocessor.js View on Github external
function getPreprocessorFactory() {

  var factory = preprocessor.createPreprocessor;

  if (!arrayEquals(factory.$inject, api)) {
    console.log('incompatible karma preprocessor: found', factory.$inject, 'expected', api);
    throw new Error('incompatible karma preprocessor');
  }

  return factory;
}
github MortenHoustonLudvigsen / KarmaTestAdapter / karma-vs-reporter / src / Commands / Discover.ts View on Github external
export function run(config: Util.Config, outputFile: string) {
    Globals.Configure({ outputFile: outputFile });
    var di = require('di');
    new di.Injector([{
        emitter: ['type', require('karma/lib/events').EventEmitter],
        config: ['value', Util.getKarmaConfig(config)],
        preprocess: ['factory', require('karma/lib/preprocessor').createPreprocessor],
        fileList: ['type', require('karma/lib/file_list').List]
    }]).invoke(discoverTests);
}
github MortenHoustonLudvigsen / KarmaTestAdapter / karma-vs-reporter / src / Commands / Discover.js View on Github external
function run(config, outputFile) {
    Globals.Configure({ outputFile: outputFile });
    var di = require('di');
    new di.Injector([{
            emitter: ['type', require('karma/lib/events').EventEmitter],
            config: ['value', Util.getKarmaConfig(config)],
            preprocess: ['factory', require('karma/lib/preprocessor').createPreprocessor],
            fileList: ['type', require('karma/lib/file_list').List]
        }]).invoke(discoverTests);
}
exports.run = run;
github MortenHoustonLudvigsen / KarmaTestAdapter / karma-vs-reporter / src / Commands.js View on Github external
function discover(config, outputFile) {
        var di = require('karma/node_modules/di');
        var logger = require("karma/lib/logger");
        var preprocessor = require('karma/lib/preprocessor');
        var fileList = require('karma/lib/file_list').List;
        var emitter = require('karma/lib/events').EventEmitter;
        var karmaConfig = getKarmaConfig(config);

        var modules = [{
                logger: ['value', logger],
                emitter: ['type', emitter],
                config: ['value', karmaConfig],
                preprocess: ['factory', preprocessor.createPreprocessor],
                fileList: ['type', fileList]
            }];

        var discoverTests = function (fileList, logger, config) {
            var log = Util.createLogger(logger);
            try  {
                Util.baseDir = config.basePath;
                var karma = new Test.Karma();

                karma.add(new Test.KarmaConfig(karmaConfig));

                fileList.refresh().then(function (files) {
                    try  {
                        parseFiles(karma, files, log);
                        var xml = karma.toXml();
                        Util.writeFile(outputFile, karma.toXml());