From ab2db20d3ce80b182b7c498f4af01264ef9e7091 Mon Sep 17 00:00:00 2001 From: Shaoquan Chen Date: Thu, 7 Jan 2016 11:34:21 -0800 Subject: [PATCH] Installing Karma --- .gitignore | 1 + src/app/app.spec.js | 10 ++++++++ tools/karma.conf.js | 60 +++++++++++++++++++++++++++++++++++++++++++++ tools/package.json | 10 ++++++++ 4 files changed, 81 insertions(+) create mode 100644 src/app/app.spec.js create mode 100644 tools/karma.conf.js diff --git a/.gitignore b/.gitignore index 20d3e2defc..14e949c0fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea +**/.*/* npm-debug.log node_modules dist diff --git a/src/app/app.spec.js b/src/app/app.spec.js new file mode 100644 index 0000000000..85b1b7dcb5 --- /dev/null +++ b/src/app/app.spec.js @@ -0,0 +1,10 @@ +(function () { + 'use strict'; + + describe('app', function () { + it('should', function () { + expect(true).toBe(true); + }); + }); + +})(); diff --git a/tools/karma.conf.js b/tools/karma.conf.js new file mode 100644 index 0000000000..45d89730d4 --- /dev/null +++ b/tools/karma.conf.js @@ -0,0 +1,60 @@ +'use strict'; + +module.exports = function (config) { + + config.set({ + + autoWatch: true, + + basePath: '../src/', + + browsers: ['PhantomJS'], + + coverageReporter: { + type: 'html', + dir: '../tools/.coverage-karma/' + }, + + files: [ + 'config.js', + + 'lib/angular/angular.min.js', + 'lib/helion-ui-framework/**/*.module.js', + 'lib/helion-ui-framework/**/!(*.mock|*.spec).js', + 'lib/helion-ui-framework/**/!(*.mock).html', + + 'index.module.js', + 'app/**/*.module.js', + 'app/**/!(*.mock|*.spec).js', + 'app/**/*.mock.js', + 'app/**/*.spec.js', + 'app/**/*.html' + ], + + frameworks: ['jasmine'], + + ngHtml2JsPreprocessor: { + moduleName: 'templates' + }, + + phantomjsLauncher: { + // Have phantomjs exit if a ResourceError is encountered + // (useful if karma exits without killing phantom) + exitOnResourceError: true + }, + + plugins: [ + 'karma-phantomjs-launcher', + 'karma-jasmine', + 'karma-ng-html2js-preprocessor', + 'karma-coverage' + ], + + preprocessors: { + 'app/**/*.html': ['ng-html2js'], + 'app/**/!(*.mock|*.spec).js': ['coverage'] + }, + + reporters: ['progress', 'coverage'] + }); +}; diff --git a/tools/package.json b/tools/package.json index f169411731..fc94c3d065 100644 --- a/tools/package.json +++ b/tools/package.json @@ -16,5 +16,15 @@ "gulp-inject": "^3.0.0", "gulp-sass": "^2.1.1", "run-sequence": "^1.1.5" + }, + "devDependencies": { + "jasmine-core": "^2.4.1", + "karma": "^0.13.19", + "karma-cli": "^0.1.2", + "karma-coverage": "^0.5.3", + "karma-jasmine": "^0.3.6", + "karma-ng-html2js-preprocessor": "^0.2.0", + "karma-phantomjs-launcher": "^0.2.3", + "phantomjs": "^1.9.19" } }