Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

Commit

Permalink
Merge pull request #11 from kasperlewau/feat/unit-tests
Browse files Browse the repository at this point in the history
feat(tests): unit all the tests
  • Loading branch information
ProLoser committed Oct 19, 2015
2 parents a66a5ba + 7432434 commit 1f4ad41
Show file tree
Hide file tree
Showing 9 changed files with 1,243 additions and 618 deletions.
615 changes: 309 additions & 306 deletions dist/mention.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/mention.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var gulp = require('gulp'),
plugins = require('gulp-load-plugins')();
plugins = require('gulp-load-plugins')(),
Karma = require('karma').Server;

var paths = {
scripts: {
Expand All @@ -25,7 +26,6 @@ var paths = {
}
};


gulp.task('default', ['scripts']);

gulp.task('example', ['scripts:example', 'styles:example']);
Expand Down Expand Up @@ -68,3 +68,14 @@ function styles(path) {
.pipe(plugins.sourcemaps.write('.'));
}
}

gulp.task('karma', karma());
gulp.task('watch:karma', karma({ singleRun: false, autoWatch: true }));
function karma (opts) {
opts = opts || {};
opts.configFile = __dirname + '/karma.conf.js';

return function (done) {
return new Karma(opts, done).start();
}
}
23 changes: 23 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['mocha', 'chai', 'chai-sinon'],
files: [
'node_modules/angular/angular.js',
'node_modules/angular-mocks/angular-mocks.js',
'src/**/*.js',
'test/**/*.js'
],
preprocessors: {
'src/**/*.js': 'babel',
'test/**/*.js': 'babel'
},
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: ['PhantomJS'],
singleRun: true
});
};
14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,19 @@
"gulp-sequence": "^0.4.0",
"gulp-sourcemaps": "^1.5.2",
"gulp-uglify": "^1.2.0"
},
"devDependencies": {
"angular": "^1.3.18",
"angular-mocks": "^1.3.18",
"chai": "^3.2.0",
"karma": "^0.13.9",
"karma-babel-preprocessor": "^5.2.1",
"karma-chai": "^0.1.0",
"karma-chai-sinon": "^0.1.5",
"karma-mocha": "^0.2.0",
"karma-phantomjs-launcher": "^0.2.1",
"mocha": "^2.2.5",
"phantomjs": "^1.9.18",
"sinon-chai": "^2.8.0"
}
}
Loading

0 comments on commit 1f4ad41

Please sign in to comment.