lib/adapter.js
function(karma, System, Promise) {
      // Fail fast if any of the dependencies are undefined
      if (!karma) {
        (console.error || console.log)('Error: Not setup properly.  window.__karma__ is undefined');
        return;
      }
      if (!System) {
        (console.error || console.log)('Error: Not setup properly.  window.System is undefined');
        return;
      }
      if (!Promise) {
        (console.error || console.log)('Error: Not setup properly.  window.Promise is undefined');
        return;
      }

      // Stop karma from starting automatically on load
      karma.loaded = function() {

        // Load SystemJS configuration from karma config
        // And update baseURL with '/base', where Karma serves files from
        if (karma.config.systemjs.config) {
          // SystemJS config is converted to a JSON string by the framework
          // https://github.com/rolaveric/karma-systemjs/issues/44
          karma.config.systemjs.config = JSON.parse(karma.config.systemjs.config);

          karma.config.systemjs.config.baseURL = adapter.updateBaseURL(karma.config.systemjs.config.baseURL);
          System.config(karma.config.systemjs.config);

          // Exclude bundle configurations if useBundles option is not specified
          if (!karma.config.systemjs.useBundles) {
            System.bundles = [];
          }

        } else {
          System.config({baseURL: '/base/'});
        }

        // Convert the 'importPatterns' into 'importRegexps'
        var importPatterns = karma.config.systemjs.importPatterns;
        var importRegexps = [];
        for (var x = 0; x < importPatterns.length; x++) {
          importRegexps.push(new RegExp(importPatterns[x]));
        }

        // Import each test suite using SystemJS
        var testSuitePromise;
        try {
          testSuitePromise = adapter.importFiles(System, Promise, karma.files, importRegexps, karma.config.systemjs.strictImportSequence);
        } catch (e) {
          karma.error(adapter.decorateErrorWithHints(e, System));
          return;
        }

        // Once all imports are complete...
        testSuitePromise.then(function () {
          karma.start();
        }, function (e) {
          karma.error(adapter.decorateErrorWithHints(e, System));
        });
      };
    }
function(karma, System, Promise) {
      // Fail fast if any of the dependencies are undefined
      if (!karma) {
        (console.error || console.log)('Error: Not setup properly.  window.__karma__ is undefined');
        return;
      }
      if (!System) {
        (console.error || console.log)('Error: Not setup properly.  window.System is undefined');
        return;
      }
      if (!Promise) {
        (console.error || console.log)('Error: Not setup properly.  window.Promise is undefined');
        return;
      }

      // Stop karma from starting automatically on load
      karma.loaded = function() {

        // Load SystemJS configuration from karma config
        // And update baseURL with '/base', where Karma serves files from
        if (karma.config.systemjs.config) {
          // SystemJS config is converted to a JSON string by the framework
          // https://github.com/rolaveric/karma-systemjs/issues/44
          karma.config.systemjs.config = JSON.parse(karma.config.systemjs.config);

          karma.config.systemjs.config.baseURL = adapter.updateBaseURL(karma.config.systemjs.config.baseURL);
          System.config(karma.config.systemjs.config);

          // Exclude bundle configurations if useBundles option is not specified
          if (!karma.config.systemjs.useBundles) {
            System.bundles = [];
          }

        } else {
          System.config({baseURL: '/base/'});
        }

        // Convert the 'importPatterns' into 'importRegexps'
        var importPatterns = karma.config.systemjs.importPatterns;
        var importRegexps = [];
        for (var x = 0; x < importPatterns.length; x++) {
          importRegexps.push(new RegExp(importPatterns[x]));
        }

        // Import each test suite using SystemJS
        var testSuitePromise;
        try {
          testSuitePromise = adapter.importFiles(System, Promise, karma.files, importRegexps, karma.config.systemjs.strictImportSequence);
        } catch (e) {
          karma.error(adapter.decorateErrorWithHints(e, System));
          return;
        }

        // Once all imports are complete...
        testSuitePromise.then(function () {
          karma.start();
        }, function (e) {
          karma.error(adapter.decorateErrorWithHints(e, System));
        });
      };
    }
function ( karma , System , Promise ) { // Fail fast if any of the dependencies are undefined if ( ! karma ) { ( console . error || console . log ) ( 'Error: Not setup properly.  window.__karma__ is undefined' ) ; return ; } if ( ! System ) { ( console . error || console . log ) ( 'Error: Not setup properly.  window.System is undefined' ) ; return ; } if ( ! Promise ) { ( console . error || console . log ) ( 'Error: Not setup properly.  window.Promise is undefined' ) ; return ; } // Stop karma from starting automatically on load karma . loaded = function ( ) { // Load SystemJS configuration from karma config // And update baseURL with '/base', where Karma serves files from if ( karma . config . systemjs . config ) { // SystemJS config is converted to a JSON string by the framework // https://github.com/rolaveric/karma-systemjs/issues/44 karma . config . systemjs . config = JSON . parse ( karma . config . systemjs . config ) ; karma . config . systemjs . config . baseURL = adapter . updateBaseURL ( karma . config . systemjs . config . baseURL ) ; System . config ( karma . config . systemjs . config ) ; // Exclude bundle configurations if useBundles option is not specified if ( ! karma . config . systemjs . useBundles ) { System . bundles = [ ] ; } } else { System . config ( { baseURL : '/base/' } ) ; } // Convert the 'importPatterns' into 'importRegexps' var importPatterns = karma . config . systemjs . importPatterns ; var importRegexps = [ ] ; for ( var x = 0 ; x < importPatterns . length ; x ++ ) { importRegexps . push ( new RegExp ( importPatterns [ x ] ) ) ; } // Import each test suite using SystemJS var testSuitePromise ; try { testSuitePromise = adapter . importFiles ( System , Promise , karma . files , importRegexps , karma . config . systemjs . strictImportSequence ) ; } catch ( e ) { karma . error ( adapter . decorateErrorWithHints ( e , System ) ) ; return ; } // Once all imports are complete... testSuitePromise . then ( function ( ) { karma . start ( ) ; } , function ( e ) { karma . error ( adapter . decorateErrorWithHints ( e , System ) ) ; } ) ; } ; }
Has SystemJS load each test suite, then starts Karma
@param karma {object}
@param System {object}
@param Promise {object}
Has SystemJS load each test suite then starts Karma