2016-04-25 6 views
0

で未定義のforeachのを読み取ることができませんkarma/node/grunt-karmaを更新するとエラーが発生します)。 _normalizeの未定義のforEachについては、その後、ヘッダ(カルマソケット)の未定義文字にエラーが発生しました。カルマ角度2エラーは、私はカルマのランナーとの角度2をテストしようとしているいくつかの問題を持っていると、このエラーを得た_normalizeProvider

私はそれをどのように修正することができ、どこを見ていいかわかりません。多分誰かが私を助けることができますか?

マイKarma.conf //カルマ構成

module.exports = function(config) { 


    config.set({ 
    basePath: '.', 
    frameworks: ['jasmine'], 
    plugins: [ 
     'karma-jasmine', 
     'karma-chrome-launcher', 
     'karma-coverage', 
    ], 
    colors: true, 

    autoWatch: true, 
    // don't shut down phantom instance for 1 minute 
    // because should be able to reuse the instance 
    // in one testrun. E.g. run unit tests against 
    // sources and minified artifacts 
    browserNoActivityTimeout: 60000, 

    // - Chrome 
    // - ChromeCanary 
    // - Firefox 
    // - Opera 
    // - Safari (only Mac) 
    // - PhantomJS 
    // - IE (only Windows) 
    browsers: ['Chrome'], 

    logLevel: config.LOG_ERROR, 

    preprocessors: { 
     'built/production/**/!(*spec).js': ['coverage'] 
    }, 

    files: [{ 
     pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', 
     included: true, 
     watched: true 
    }, { 
     pattern: 'node_modules/systemjs/dist/system.src.js', 
     included: true, 
     watched: true 
    }, { 
     pattern: 'node_modules/rxjs/bundles/Rx.js', 
     included: true, 
     watched: true 
    }, { 
     pattern: 'node_modules/angular2/bundles/angular2.dev.js', 
     included: true, 
     watched: true 
    }, 
    { 
    pattern: 'node_modules/angular2/bundles/http.dev.js', 
    included: true, 
    watched: true 
    }, 
    { 
     pattern: 'node_modules/angular2/bundles/router.dev.js', 
     included: true, 
     watched: true 
    }, { 
     pattern: 'node_modules/angular2/bundles/testing.dev.js', 
     included: true, 
     watched: true 
    }, { 
     pattern: 'karma-test-shim.js', 
     included: true, 
     watched: true 
    }, { 
     pattern: 'src/**/*.ts', 
     included: false, 
     watched: false 
    }, { 
     pattern: 'built/production/**/*.js', 
     included: false, 
     watched: true 
    }, { 
     pattern: 'built/production/**/*.js.map', 
     included: false, 
     watched: false 
    }], 

    proxies: { 
     // required for component assests fetched by Angular's compiler 
     '/src/': './src/' 
    }, 
    port: 9876, 
    // singleRun: true, 

    reporters: ['progress', 'dots', 'coverage'], 
    coverageReporter: { 
     reporters: [{ 
     type: 'html' 
     }] 
    }, 


    }); 
}; 

カルマtest.shim

// Tun on full stack traces in errors to help debugging 
Error.stackTraceLimit = Infinity; 


jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000; 

// // Cancel Karma's synchronous start, 
// // we will call `__karma__.start()` later, once all the specs are loaded. 
__karma__.loaded = function() {}; 


System.config({ 
    packages: { 
    'built': { 
     defaultExtension: false, 
     format: 'register', 
     map: Object.keys(window.__karma__.files). 
      filter(onlyAppFiles). 
      reduce(function createPathRecords(pathsMapping, appPath) { 
       // creates local module name mapping to global path with karma's fingerprint in path, e.g.: 
       // './hero.service': '/base/src/app/hero.service.js?f4523daf879cfb7310ef6242682ccf10b2041b3e' 
       var moduleName = appPath.replace(/^\/built\//, './').replace(/\.js$/, ''); 
       pathsMapping[moduleName] = appPath + '?' + window.__karma__.files[appPath] 
       return pathsMapping; 
      }, {}) 

     } 
    } 
}); 

System.import('angular2/testing').then(function(testing) { 
    return System.import('angular2/src/platform/browser/browser_adapter').then(function(providers) { 
     testing.setBaseTestProviders(providers.TEST_BROWSER_PLATFORM_PROVIDERS, 
      providers.TEST_BROWSER_APPLICATION_PROVIDERS); 
    }); 
}).then(function() { 
    return Promise.all(
    Object.keys(window.__karma__.files) // All files served by Karma. 
    .filter(onlySpecFiles) 
    // .map(filePath2moduleName)  // Normalize paths to module names. 
    .map(function(moduleName) { 
     // loads all spec files via their global module names (e.g. 'base/src/app/hero.service.spec') 
     return System.import(moduleName); 
    })); 
}) 
.then(function() { 
    __karma__.start(); 
}, function(error) { 
    __karma__.error(error.stack || error); 
}); 


function filePath2moduleName(filePath) { 
    return filePath. 
      replace(/^\//, '').    // remove/prefix 
      replace(/\.\w+$/, '');   // remove suffix 
} 


function onlyAppFiles(filePath) { 
    return /^\/built\/.*\.js$/.test(filePath) 
} 


function onlySpecFiles(path) { 
    return /.spec\.js$/.test(path); 
} 
+0

このエラーをトリガーテストの内容は何ですか?ありがとう! –

+1

私はvar-testing = require( '@ angular/core/testing')を持っていたangular-rc.1に同様のエラーを更新しました。 var browser = require( '@ angle/platform-b​​rowser/testing'); testing.setBaseTestProviders(browser.TEST_BROWSER_PLATFORM_PROVIDERS、browser.TEST_BROWSER_APPLICATION_PROVIDERS); rc1 deprecated TEST_BROWSER_PLATFORM_PROVIDERS私はそれをコメントアウトすることが少し助けたと思います... –

答えて

0
testing.setBaseTestProviders(
browser.TEST_BROWSER_PLATFORM_P‌​ROVIDERS, browser.TEST_BROWSER_APPLICATION_PROVIDERS); 

rc1 deprecated TEST_BROWSER_PLATFORM_PROVIDERS I believe so commenting it out helped

関連する問題