From 94da2ce044f5bf38db6d7849260ab07335676b5e Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Tue, 27 Oct 2015 15:09:33 +0100 Subject: [PATCH 1/3] Cannot use syntax `var Server = require('karma').Server` otherwise Server is of type any --- karma/karma-tests.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/karma/karma-tests.ts b/karma/karma-tests.ts index dd571f8ae..41076cfda 100644 --- a/karma/karma-tests.ts +++ b/karma/karma-tests.ts @@ -29,8 +29,8 @@ karma.runner.run({port: 9876}, (exitCode: number) => { }); -var Server = require('karma').Server; -var server = new Server({port: 9876}, function(exitCode: number) { +//var Server = require('karma').Server; => cannot use this syntax otherwise Server is of type any +var server = new karma.Server({port: 9876}, function(exitCode: number) { console.log('Karma has exited with ' + exitCode); process.exit(exitCode); }); @@ -43,8 +43,8 @@ server.on('browser_register', function (browser: any) { console.log('A new browser was registered'); }); -var runner = require('karma').runner; -runner.run({port: 9876}, function(exitCode: number) { +//var runner = require('karma').runner; => cannot use this syntax otherwise runner is of type any +karma.runner.run({port: 9876}, function(exitCode: number) { console.log('Karma has exited with ' + exitCode); process.exit(exitCode); }); From 21afe00c53a0c9cdf2fb22d57d9f5adce449f45c Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Tue, 27 Oct 2015 15:10:06 +0100 Subject: [PATCH 2/3] Example of configuration file karma.conf.ts --- karma/karma-tests.ts | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/karma/karma-tests.ts b/karma/karma-tests.ts index 41076cfda..04f1c4934 100644 --- a/karma/karma-tests.ts +++ b/karma/karma-tests.ts @@ -52,3 +52,43 @@ karma.runner.run({port: 9876}, function(exitCode: number) { // var captured: boolean = karma.launcher.areAllCaptured(); + + +// Example of configuration file karma.conf.ts, see http://karma-runner.github.io/0.13/config/configuration-file.html +module.exports = function(config: karma.Config) { + config.set({ + basePath: '..', + urlRoot: '/base/', + frameworks: ['jasmine'], + + files: [ + 'file1.js', + 'file2.js', + 'file3.js', + { + pattern: '**/*.html', + included: false + } + ], + + reporters: [ + 'progress', + 'coverage' + ], + + preprocessors: { + 'app.js': ['coverage'] + }, + + port: 9876, + + autoWatch: true, + + browsers: [ + 'Chrome', + 'Firefox' + ], + + singleRun: true + }); +}; From e123fee7b41f18f47c03ada42b86bdfe946f976c Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Tue, 27 Oct 2015 15:11:32 +0100 Subject: [PATCH 3/3] Test logLevel configuration option --- karma/karma-tests.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/karma/karma-tests.ts b/karma/karma-tests.ts index 04f1c4934..7dbd533b5 100644 --- a/karma/karma-tests.ts +++ b/karma/karma-tests.ts @@ -30,7 +30,7 @@ karma.runner.run({port: 9876}, (exitCode: number) => { //var Server = require('karma').Server; => cannot use this syntax otherwise Server is of type any -var server = new karma.Server({port: 9876}, function(exitCode: number) { +var server = new karma.Server({logLevel: 'debug', port: 9876}, function(exitCode: number) { console.log('Karma has exited with ' + exitCode); process.exit(exitCode); }); @@ -57,6 +57,7 @@ var captured: boolean = karma.launcher.areAllCaptured(); // Example of configuration file karma.conf.ts, see http://karma-runner.github.io/0.13/config/configuration-file.html module.exports = function(config: karma.Config) { config.set({ + logLevel: config.LOG_DEBUG, basePath: '..', urlRoot: '/base/', frameworks: ['jasmine'],