2015-08-17 3 views
0

Я не могу понять, как сделать карму, чтобы не следить за изменениями в папке jspm_packages/. Если я пытаюсь добавить в «jspm_packages» исключить раздел, то я получаю следующие ошибки:jspm + KarmaJS - исключить файлы из часов, но не из сервисов

 
DEBUG [web-server]: serving (cached): /Users/jm/dev/monka/node_modules/gulp-helpers/node_modules/karma-jspm/src/adapter.js 
PhantomJS 1.9.8 (Mac OS X 0.0.0) ERROR 
    ReferenceError: Can't find variable: System 
    at /Users/jm/dev/monka/system.config.js:1 

ERROR [PhantomJS 1.9.8 (Mac OS X 0.0.0)]: ReferenceError: Can't find variable: System 
at http://localhost:9876/base/system.config.js?31f6cba38ed6c99ea3e9b4bc926e8ecfd6de8bd7:1 

Вот мой karma.conf.js

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

    plugins: [ 
     'karma-jspm', 
     'karma-jasmine', 
     'karma-beep-reporter', 
     'karma-verbose-reporter', 
     'karma-babel-preprocessor', 
     'karma-phantomjs-launcher' 
    ], 

    basePath : '',     // base path that will be used to resolve all patterns (eg. files, exclude) 
    frameworks : ['jspm', 'jasmine'], // frameworks to use available frameworks: https://npmjs.org/browse/keyword/karma-adapter 
    browsers : ['PhantomJS'],  // start these browsers available browser launchers: https://npmjs.org/browse/keyword/karma-launcher 
    reporters : ['progress', 'beep', 'verbose'/*, 'coverage'*/], // test results reporter to use possible values: 'dots', 'progress' available reporters: https://npmjs.org/browse/keyword/karma-reporter 
    singleRun : false, // Continuous Integration mode if true, Karma captures browsers, runs the tests and exits 
    autoWatch : true, // Enable/disable watching file and executing tests whenever any file changes 
    colors  : true, // enable/disable colors in the output (reporters and logs) 
    files  : [], // list of files/patterns to load in the browser 

    jspm: { 
     config  : 'system.config.js', 
     loadFiles : ['test-unit/**/*.js'], 
     serveFiles : ['dist/**/**'] 
    }, 

    proxies: { 
     '/base/app'  : '/base/dist/app', 
     '/base/common' : '/base/dist/common', 
     '/jspm_packages' : '/base/jspm_packages' 
    }, 

    exclude: [ 
     'coverage/**', 
     'typings/**', 
     'dist/**/*.js.map' 
    ], 

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

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

    babelPreprocessor: { 
     options: { sourceMap:'inline', modules:'system' } 
    }, 

    coverageReporter: { type:'html', dir:'coverage/' } 

    }); 
}; 

ответ

0

Я думаю, что с кармой не можно исключить файлы, за которыми следует смотреть, которые также должны обслуживаться. Исключая jspm_packages, Karma перестает обслуживать system.js, который находится в папке jspm_packages, и поэтому система не определена.

Если вы хотите избавиться от обслуживания jspm_packages во время тестового прогона, вы можете попробовать запустить тесты после создания самоисполняющегося пакета и просто обслуживать этот пакет.

См. https://github.com/jspm/jspm-cli/blob/master/docs/production-workflows.md#creating-a-self-executing-bundle