Adding karma tests to grunt build

This commit is contained in:
jdescottes 2014-08-14 01:50:33 +02:00
parent 8d8c40e6a6
commit b0ec276aac
4 changed files with 16 additions and 26 deletions

View File

@ -228,6 +228,11 @@ module.exports = function(grunt) {
dest: 'build/closure/closure_compiled_binary.js' dest: 'build/closure/closure_compiled_binary.js'
} }
}, },
karma: {
unit: {
configFile: 'karma.conf.js'
}
},
nodewebkit: { nodewebkit: {
options: { options: {
build_dir: './dest/desktop/', // destination folder of releases. build_dir: './dest/desktop/', // destination folder of releases.
@ -262,6 +267,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-replace'); grunt.loadNpmTasks('grunt-replace');
grunt.loadNpmTasks('grunt-ghost'); grunt.loadNpmTasks('grunt-ghost');
grunt.loadNpmTasks('grunt-open'); grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-leading-indent'); grunt.loadNpmTasks('grunt-leading-indent');
grunt.loadNpmTasks('grunt-node-webkit-builder'); grunt.loadNpmTasks('grunt-node-webkit-builder');
grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-copy');
@ -269,8 +275,11 @@ module.exports = function(grunt) {
// Validate // Validate
grunt.registerTask('lint', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint']); grunt.registerTask('lint', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint']);
// karma/unit-tests task
grunt.registerTask('unit-test', ['karma']);
// Validate & Test // Validate & Test
grunt.registerTask('test', ['lint', 'compile', 'express:test', 'ghost:default']); grunt.registerTask('test', ['lint', 'compile', 'unit-test','express:test', 'ghost:default']);
// Validate & Test (faster version) will NOT work on travis !! // Validate & Test (faster version) will NOT work on travis !!
grunt.registerTask('precommit', ['lint', 'compile', 'express:test', 'ghost:local']); grunt.registerTask('precommit', ['lint', 'compile', 'express:test', 'ghost:local']);

View File

@ -60,11 +60,11 @@ module.exports = function(config) {
// start these browsers // start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'], browsers: ['PhantomJS'],
// Continuous Integration mode // Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits // if true, Karma captures browsers, runs the tests and exits
singleRun: false singleRun: true
}); });
}; };

View File

@ -12,34 +12,14 @@ SETLOCAL
set APP_BIN="%PISKEL_HOME%\dest\desktop\cache\win\0.9.2" set APP_BIN="%PISKEL_HOME%\dest\desktop\cache\win\0.9.2"
set MISC_FOLDER=%PISKEL_HOME%\misc set MISC_FOLDER=%PISKEL_HOME%\misc
set RELEASES_FOLDER=%PISKEL_HOME%\dest\desktop\releases set RELEASES_FOLDER=%PISKEL_HOME%\dest\desktop\releases
set DEST_FOLDER=%RELEASES_FOLDER%\win set DEST_FOLDER=%RELEASES_FOLDER%\piskel\win\piskel
ECHO "Building Piskel executable for Windows ..."
ECHO "Creating release directory ..."
MKDIR "%DEST_FOLDER%"
ECHO "DONE"
ECHO "Packaging executable ..."
COPY /b "%APP_BIN%\nw.exe"+"%RELEASES_FOLDER%\piskel\piskel.nw" "%DEST_FOLDER%\piskel-raw.exe"
ECHO "DONE"
ECHO "COPYing dependencies ..."
COPY "%APP_BIN%\*.dll" "%DEST_FOLDER%\"
COPY "%APP_BIN%\nw.pak" "%DEST_FOLDER%\"
ECHO "DONE"
ECHO "Updating Piskel icon -- Using Resource Hacker" ECHO "Updating Piskel icon -- Using Resource Hacker"
%RESOURCE_HACKER_PATH%\ResHacker -addoverwrite "%DEST_FOLDER%\piskel-raw.exe", "%DEST_FOLDER%\piskel-exploded.exe", "%MISC_FOLDER%\desktop\logo.ico", ICONGROUP, IDR_MAINFRAME, 1033 %RESOURCE_HACKER_PATH%\ResHacker -addoverwrite "%DEST_FOLDER%\piskel.exe", "%DEST_FOLDER%\piskel-logo.exe", "%MISC_FOLDER%\desktop\logo.ico", ICONGROUP, IDR_MAINFRAME, 1033
DEL "%DEST_FOLDER%\piskel-raw.exe" DEL "%DEST_FOLDER%\piskel.exe"
ECHO "DONE" ECHO "DONE"
ECHO "Boxing application to single file -- Using Enigma Virtual Box"
%VBOX_PATH%\enigmavbconsole "%MISC_FOLDER%\desktop\package-piskel.evb"
DEL "%DEST_FOLDER%\*.dll"
DEL "%DEST_FOLDER%\nw.pak"
DEL "%DEST_FOLDER%\piskel-exploded.exe"
ECHO "DONE"
PAUSE PAUSE
explorer "%DEST_FOLDER%\" explorer "%DEST_FOLDER%\"

View File

@ -29,6 +29,7 @@
"grunt-node-webkit-builder": "0.1.21", "grunt-node-webkit-builder": "0.1.21",
"grunt-open": "0.2.3", "grunt-open": "0.2.3",
"grunt-replace": "0.7.8", "grunt-replace": "0.7.8",
"grunt-karma": "~0.8.2",
"karma": "0.12.17", "karma": "0.12.17",
"karma-chrome-launcher": "^0.1.4", "karma-chrome-launcher": "^0.1.4",
"karma-jasmine": "^0.1.5", "karma-jasmine": "^0.1.5",