Updated karma to 0.9
Tests are now cross-platform and runs in local phantomJS instead of in chrome, remember to run npm install to upgrade
This commit is contained in:
@@ -7,17 +7,19 @@ module.exports = function (grunt) {
|
||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
grunt.loadNpmTasks('grunt-recess');
|
||||
grunt.loadNpmTasks('grunt-testacular');
|
||||
|
||||
grunt.loadNpmTasks('grunt-karma');
|
||||
|
||||
grunt.loadNpmTasks('grunt-open');
|
||||
grunt.loadNpmTasks('grunt-markdown');
|
||||
grunt.loadNpmTasks('grunt-contrib-connect');
|
||||
|
||||
// Default task.
|
||||
grunt.registerTask('default', ['jshint:dev','build','testacular:unit']);
|
||||
grunt.registerTask('default', ['jshint:dev','build','karma:unit']);
|
||||
grunt.registerTask('dev', ['jshint:dev', 'build', 'webserver', 'open:dev', 'watch']);
|
||||
|
||||
//run by the watch task
|
||||
grunt.registerTask('watch-build', ['jshint:dev','recess:build','testacular:unit','concat','copy']);
|
||||
grunt.registerTask('watch-build', ['jshint:dev','recess:build','karma:unit','concat','copy']);
|
||||
|
||||
//triggered from grunt dev or grunt
|
||||
grunt.registerTask('build', ['clean','concat','recess:build','copy']);
|
||||
@@ -31,12 +33,6 @@ module.exports = function (grunt) {
|
||||
grunt.log.subhead(Date());
|
||||
});
|
||||
|
||||
var testacularConfig = function(configFile, customOptions) {
|
||||
var options = { configFile: configFile, keepalive: true };
|
||||
var travisOptions = process.env.TRAVIS && { browsers: ['Firefox'], reporters: 'dots' };
|
||||
return grunt.util._.extend(options, customOptions, travisOptions);
|
||||
};
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
connect: {
|
||||
@@ -116,10 +112,10 @@ module.exports = function (grunt) {
|
||||
}
|
||||
},
|
||||
|
||||
testacular: {
|
||||
unit: { options: testacularConfig('test/config/unit.js') },
|
||||
e2e: { options: testacularConfig('test/config/e2e.js') },
|
||||
watch: { options: testacularConfig('test/config/unit.js', {singleRun:false, autoWatch: true}) }
|
||||
karma: {
|
||||
unit: { configFile: 'test/config/karma.conf.js', keepalive: true },
|
||||
e2e: { configFile: 'test/config/e2e.js', keepalive: true },
|
||||
watch: { configFile: 'test/config/unit.js', singleRun:false, autoWatch: true, keepalive: true }
|
||||
},
|
||||
|
||||
concat:{
|
||||
|
||||
@@ -22,18 +22,26 @@
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"grunt": "~0.4.0",
|
||||
"phantomjs": "~1.9.1-0",
|
||||
"grunt-recess": "~0.3",
|
||||
"grunt-contrib-clean": "~0.4.0",
|
||||
"grunt-contrib-copy": "~0.4.0",
|
||||
"grunt-contrib-jshint": "~0.2.0",
|
||||
"grunt-contrib-concat": "~0.1.3",
|
||||
"grunt-contrib-uglify": "~0.1.1",
|
||||
"grunt-contrib-requirejs": "~0.4.0",
|
||||
"grunt-testacular": "~0.3.0",
|
||||
"grunt-html2js": "~0.1.0",
|
||||
"grunt-contrib-watch": "~0.3.1",
|
||||
"grunt-markdown": "~0.2.0",
|
||||
"grunt-open": "~0.2.0",
|
||||
"grunt-contrib-connect": "~0.3.0"
|
||||
"grunt-contrib-connect": "~0.3.0",
|
||||
"grunt-karma": "~0.5",
|
||||
"karma-chrome-launcher": "0.0.2",
|
||||
"karma-script-launcher": "0.0.1",
|
||||
"karma-firefox-launcher": "0.0.2",
|
||||
"karma-jasmine": "0.0.1",
|
||||
"karma-requirejs": "0.0.1",
|
||||
"karma-coffee-preprocessor": "0.0.1",
|
||||
"karma": "~0.9",
|
||||
"karma-phantomjs-launcher": "0.0.2"
|
||||
}
|
||||
}
|
||||
|
||||
93
src/Umbraco.Web.UI.Client/test/config/karma.conf.js
Normal file
93
src/Umbraco.Web.UI.Client/test/config/karma.conf.js
Normal file
@@ -0,0 +1,93 @@
|
||||
module.exports = function(karma) {
|
||||
karma.configure({
|
||||
// base path, that will be used to resolve files and exclude
|
||||
basePath: '../..',
|
||||
|
||||
frameworks: ['jasmine'],
|
||||
|
||||
// list of files / patterns to load in the browser
|
||||
files: [
|
||||
'lib/jquery/jquery-1.8.2.min.js',
|
||||
'lib/angular/angular.min.js',
|
||||
'test/lib/angular/angular-mocks.js',
|
||||
'src/app_dev.js',
|
||||
'src/common/directives/*.js',
|
||||
'src/common/filters/*.js',
|
||||
'src/common/services/*.js',
|
||||
'src/common/security/*.js',
|
||||
'src/common/mocks/**/*.js',
|
||||
'src/views/**/*.controller.js',
|
||||
'test/unit/**/*.spec.js'
|
||||
],
|
||||
|
||||
// list of files to exclude
|
||||
exclude: [],
|
||||
|
||||
// use dolts reporter, as travis terminal does not support escaping sequences
|
||||
// possible values: 'dots', 'progress', 'junit', 'teamcity'
|
||||
// CLI --reporters progress
|
||||
reporters: ['progress'],
|
||||
|
||||
junitReporter: {
|
||||
// will be resolved to basePath (in the same way as files/exclude patterns)
|
||||
outputFile: 'test-results.xml'
|
||||
},
|
||||
|
||||
// web server port
|
||||
// CLI --port 9876
|
||||
port: 9876,
|
||||
|
||||
// cli runner port
|
||||
// CLI --runner-port 9100
|
||||
runnerPort: 9100,
|
||||
|
||||
// enable / disable colors in the output (reporters and logs)
|
||||
// CLI --colors --no-colors
|
||||
colors: true,
|
||||
|
||||
// level of logging
|
||||
// possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG
|
||||
// CLI --log-level debug
|
||||
logLevel: karma.LOG_INFO,
|
||||
|
||||
// enable / disable watching file and executing tests whenever any file changes
|
||||
// CLI --auto-watch --no-auto-watch
|
||||
autoWatch: false,
|
||||
|
||||
// Start these browsers, currently available:
|
||||
// - Chrome
|
||||
// - ChromeCanary
|
||||
// - Firefox
|
||||
// - Opera
|
||||
// - Safari (only Mac)
|
||||
// - PhantomJS
|
||||
// - IE (only Windows)
|
||||
// CLI --browsers Chrome,Firefox,Safari
|
||||
browsers: ['PhantomJS'],
|
||||
|
||||
// If browser does not capture in given timeout [ms], kill it
|
||||
// CLI --capture-timeout 5000
|
||||
captureTimeout: 5000,
|
||||
|
||||
// Auto run tests on start (when browsers are captured) and exit
|
||||
// CLI --single-run --no-single-run
|
||||
singleRun: true,
|
||||
|
||||
// report which specs are slower than 500ms
|
||||
// CLI --report-slower-than 500
|
||||
reportSlowerThan: 500,
|
||||
|
||||
// compile coffee scripts
|
||||
preprocessors: {
|
||||
'**/*.coffee': 'coffee'
|
||||
},
|
||||
|
||||
plugins: [
|
||||
'karma-jasmine',
|
||||
'karma-chrome-launcher',
|
||||
'karma-firefox-launcher',
|
||||
'karma-phantomjs-launcher',
|
||||
'karma-junit-reporter'
|
||||
]
|
||||
});
|
||||
};
|
||||
@@ -19,6 +19,12 @@ files = [
|
||||
'test/unit/**/*.spec.js'
|
||||
];
|
||||
|
||||
plugins = [
|
||||
'karma-jasmine',
|
||||
'karma-chrome-launcher',
|
||||
'karma-phantomjs-launcher'
|
||||
];
|
||||
|
||||
// use dots reporter, as travis terminal does not support escaping sequences
|
||||
// possible values: 'dots' || 'progress'
|
||||
reporters = 'progress';
|
||||
@@ -51,7 +57,7 @@ autoWatchInterval = 0;
|
||||
// - Opera
|
||||
// - Safari
|
||||
// - PhantomJS
|
||||
browsers = ['Chrome'];
|
||||
browsers = ['PhantomJS'];
|
||||
|
||||
// Continuous Integration mode
|
||||
// if true, it capture browsers, run tests and exit
|
||||
|
||||
Reference in New Issue
Block a user