online are some fixes for my problem but I didnt get any to run. My problem is, that every time I add the preprocessors to my karma.conf.js I get a originalErr but otherwise I get a require is not defined error.
Here the karma.conf.js with the preprocessors: module.exports = function(config) {
var appBase = 'app/';
var backBase = 'backend/';
var cssBase = 'css/';
var testBase = 'test/';
config.set({
basePath: '.',
frameworks: [ 'jasmine' , 'browserify' ],
browserify: {
watch: true,
debug: true
},
preprocessors: {
'test/**/*.ts': [ 'browserify' ]
},
plugins: [
'karma-browserify',
'karma-jasmine',
'karma-coverage',
'karma-chrome-launcher'
],
browserNoActivityTimeout: 10000,
customLaunchers: {
// From the CLI. Not used here but interesting
// chrome setup for travis CI using chromium
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
},
files: [
//file
'app/*.ts',
// System.js for module loading
'node_modules/systemjs/dist/system.src.js',
// Polyfills
'node_modules/core-js/client/shim.js',
'node_modules/reflect-metadata/Reflect.js',
// zone.js
'node_modules/zone.js/dist/zone.js',
'node_modules/http://ift.tt/1KReNIi',
'node_modules/http://ift.tt/2c7PMID',
'node_modules/http://ift.tt/2cGDBrq',
'node_modules/http://ift.tt/1KReLA0',
'node_modules/http://ift.tt/2anIl3w',
'node_modules/http://ift.tt/2b8mEkP',
// RxJs
{ pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false },
{ pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false },
// Paths loaded via module imports:
// Angular itself
{pattern: 'node_modules/@angular/**/*.js', included: false, watched: false},
{pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: false},
{pattern: 'systemjs.config.js', included: false, watched: false},
{pattern: 'systemjs.config.js', included: false, watched: false},
'karma-test-shim.js',
{pattern: appBase + '*.ts', included: false, watched: true},
{pattern: appBase + '**/*.ts', included: false, watched: true},
{pattern: appBase + '**/*.html', included: false, watched: false},
{pattern: backBase + '*.js', included: false, watched: true},
{pattern: backBase + '**/*.js', included: false, watched: true},
{pattern: cssBase + '*.css', included: false, watched: false},
{pattern: testBase + '**/*.ts', included:true, watched: true},
],
// Proxied base paths for loading assets
proxies: {
// required for component assets fetched by Angular's compiler
},
exclude: [],
reporters: ['progress', 'dots', 'coverage'],
// HtmlReporter configuration
htmlReporter: {
// Open this file to see results in browser
outputFile: '_test-output/tests.html',
// Optional
pageTitle: 'Unit Tests',
subPageTitle: __dirname
},
coverageReporter: {
reporters:[
{type: 'json', subdir: '.', file: 'coverage-final.json'}
]
},
port: 4000,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
})
and here the error log
11 10 2016 08:04:27.887:WARN [web-server]: 404: /angular2/src/platform/browser/browser_adapter
Chrome 53.0.2785 (Windows 10 0.0.0) ERROR
{
"originalErr": {}
}
Chrome 53.0.2785 (Windows 10 0.0.0) ERROR
{
"originalErr": {}
}
Chrome 53.0.2785 (Windows 10 0.0.0): Executed 0 of 0 ERROR (0.246 secs / 0 secs)
Here the other error
11 10 2016 08:04:04.393:WARN [web-server]: 404: /angular2/src/platform/browser/browser_adapter
Chrome 53.0.2785 (Windows 10 0.0.0) ERROR
Uncaught ReferenceError: require is not defined
at test/frontend/overview_test.spec.ts:7
Chrome 53.0.2785 (Windows 10 0.0.0) ERROR
Uncaught ReferenceError: require is not defined
at test/frontend/overview_test.spec.ts:7
Chrome 53.0.2785 (Windows 10 0.0.0): Executed 0 of 0 ERROR (0.227 secs / 0 secs)
Aucun commentaire:
Enregistrer un commentaire