// Karma configuration
// Generated on Mon Mar 20 2017 15:06:42 GMT+0100 (CET)

const nodeResolve = require('rollup-plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');
const angular = require('rollup-plugin-angular');
const typescript = require('rollup-plugin-typescript');

module.exports = function(config) {
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',


    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['jasmine'],


    // list of files / patterns to load in the browser
    files: [
      'test/*.ts',
      'src/*.spec.ts'
    ],

    plugins: [
      require('karma-coverage'),
      require('karma-chrome-launcher'),
      require('karma-rollup-plugin'),
      require('karma-jasmine')
    ],    

    // list of files to exclude
    exclude: [
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
      'test/*.ts': ['rollup'],
      'src/*.spec.ts': ['rollup']
    },

    rollupPreprocessor: {
      context: 'this',
      // will help to prevent conflicts between different tests entries
      moduleName: '@ngx-docs/material',
      format: 'iife',
      sourceMap: 'inline',
      // rollup settings. See Rollup documentation
      plugins: [
        angular(),
        typescript({
          typescript: require('./node_modules/typescript')
        }),
        commonjs(),
        nodeResolve({
          jsnext: true,
          browser: true,
          extensions: [ '.js', '.json', 'html']
        })
      ],
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress'],


    // web server port
    port: 9876,


    // enable / disable colors in the output (reporters and logs)
    colors: true,


    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,


    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    mime: {
      'text/x-typescript': ['ts','tsx']
    },
    
    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['Chrome'],


    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false,

    // Concurrency level
    // how many browser should be started simultaneous
    concurrency: Infinity
  })
}

@@ -79,27 +79,23 @@
 %0A%0Aconst 
-nodeResolve
+angular
  = requi
@@ -116,20 +116,15 @@
 gin-
-node-resolve
+angular
 ');%0A
@@ -177,31 +177,28 @@
 js');%0Aconst 
-angular
+html
  = require('
@@ -203,39 +203,95 @@
 ('rollup-plugin-
-angular
+html');%0Aconst nodeResolve = require('rollup-plugin-node-resolve
 ');%0Aconst typesc
@@ -951,20 +951,16 @@
 clude: %5B
-%0A   
  %5D,%0A%0A   
@@ -1487,16 +1487,19 @@
 %0A       
+ //
  angular
@@ -1514,230 +1514,1109 @@
     
-typescript(%7B%0A          typescript: require('./node_modules/typescript')%0A        %7D),%0A        commonjs(),%0A        nodeResolve(%7B%0A          jsnext: true,%0A          browser: true,%0A          extensions: %5B '.js', '.json', 'html'%5D
+commonjs(%7B%0A          namedExports: %7B%0A            'node_modules/rxjs/**': %5B'named'%5D%0A          %7D%0A        %7D),%0A        html(%7B%0A          include: '**/*.html',%0A          htmlMinifierOptions: %7B%0A            caseSensitive: true // need to do not lower letter%0A          %7D%0A        %7D),%0A        nodeResolve(%7B%0A          // use %22es2015%22 field for ES2015 modules with ES2015 code,%0A          // if possible%0A          es2015: true, // Default: false%0A%0A          // use %22module%22 field for ES2015 modules with ES5 code,%0A          // if possible%0A          module: true, // Default: true%0A%0A          // use %22jsnext:main%22 if possible%0A          // %E2%80%93 see https://github.com/rollup/rollup/wiki/jsnext:main%0A          jsnext: true,  // Default: false%0A%0A          // use %22main%22 field or index.js, even if it's not an ES6 module%0A          // (needs to be converted from CommonJS to ES6%0A          // %E2%80%93 see https://github.com/rollup/rollup-plugin-commonjs%0A          main: true,  // Default: true%0A%0A          extensions: %5B '.js', '.json', 'html'%5D%0A        %7D),%0A        typescript(%7B%0A          typescript: require('./node_modules/typescript')
 %0A   

add rollup-plugins to use external template component