added karma runner + first test

This commit is contained in:
jdescottes 2014-07-23 19:42:08 +02:00
parent 1b99a22c1d
commit 05e8f9adac
5 changed files with 88 additions and 6 deletions

View file

@ -31,6 +31,7 @@ module.exports = function(grunt) {
mode : '?debug',
delay : delay
},
async : false,
direct : false,
logLevel : 'info',
printCommand : false,

70
karma.conf.js Normal file
View file

@ -0,0 +1,70 @@
// Karma configuration
// Generated on Tue Jul 22 2014 23:49:26 GMT+0200 (Romance Daylight Time)
module.exports = function(config) {
var mapToSrcFolder = function (path) {return ['src', path].join('/');};
var piskelScripts = require('./src/piskel-script-list.js').scripts.map(mapToSrcFolder);
piskelScripts.push('test/**/*.js');
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: piskelScripts,
// list of files to exclude
exclude: [
'src/js/app.js',
'test/integration/**/*.js'
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
});
};

View file

@ -14,7 +14,9 @@
"start": "nodewebkit"
},
"devDependencies": {
"dateformat": "1.0.8-1.2.3",
"grunt": "~0.4.5",
"grunt-closure-tools": "~0.9.7",
"grunt-contrib-clean": "0.5.0",
"grunt-contrib-concat": "0.5.0",
"grunt-contrib-copy": "0.5.0",
@ -22,14 +24,15 @@
"grunt-contrib-uglify": "0.5.0",
"grunt-contrib-watch": "0.6.1",
"grunt-express": "1.4.1",
"grunt-replace": "0.7.8",
"grunt-ghost": "1.1.0",
"grunt-open": "0.2.3",
"grunt-leading-indent": "0.1.0",
"grunt-closure-tools": "~0.9.7",
"grunt-node-webkit-builder": "0.1.21",
"nodewebkit": "~0.9.2-8",
"dateformat" : "1.0.8-1.2.3"
"grunt-open": "0.2.3",
"grunt-replace": "0.7.8",
"karma": "0.12.17",
"karma-chrome-launcher": "^0.1.4",
"karma-jasmine": "^0.1.5",
"nodewebkit": "~0.9.2-8"
},
"window": {
"title": "Piskel",

View file

@ -0,0 +1,8 @@
describe("History Service suite", function() {
it("contains spec with an expectation", function() {
var mockPiskelController = {};
var historyService = new pskl.service.HistoryService(mockPiskelController);
expect(historyService.currentIndex).toBe(0);
});
});