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

Commit 1f4ad41

Browse files
committed
Merge pull request #11 from kasperlewau/feat/unit-tests
feat(tests): unit all the tests
2 parents a66a5ba + 7432434 commit 1f4ad41

File tree

9 files changed

+1243
-618
lines changed

9 files changed

+1243
-618
lines changed

dist/mention.js

Lines changed: 309 additions & 306 deletions
Large diffs are not rendered by default.

dist/mention.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gulpfile.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var gulp = require('gulp'),
2-
plugins = require('gulp-load-plugins')();
2+
plugins = require('gulp-load-plugins')(),
3+
Karma = require('karma').Server;
34

45
var paths = {
56
scripts: {
@@ -25,7 +26,6 @@ var paths = {
2526
}
2627
};
2728

28-
2929
gulp.task('default', ['scripts']);
3030

3131
gulp.task('example', ['scripts:example', 'styles:example']);
@@ -68,3 +68,14 @@ function styles(path) {
6868
.pipe(plugins.sourcemaps.write('.'));
6969
}
7070
}
71+
72+
gulp.task('karma', karma());
73+
gulp.task('watch:karma', karma({ singleRun: false, autoWatch: true }));
74+
function karma (opts) {
75+
opts = opts || {};
76+
opts.configFile = __dirname + '/karma.conf.js';
77+
78+
return function (done) {
79+
return new Karma(opts, done).start();
80+
}
81+
}

karma.conf.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = function(config) {
2+
config.set({
3+
basePath: '',
4+
frameworks: ['mocha', 'chai', 'chai-sinon'],
5+
files: [
6+
'node_modules/angular/angular.js',
7+
'node_modules/angular-mocks/angular-mocks.js',
8+
'src/**/*.js',
9+
'test/**/*.js'
10+
],
11+
preprocessors: {
12+
'src/**/*.js': 'babel',
13+
'test/**/*.js': 'babel'
14+
},
15+
reporters: ['progress'],
16+
port: 9876,
17+
colors: true,
18+
logLevel: config.LOG_INFO,
19+
autoWatch: false,
20+
browsers: ['PhantomJS'],
21+
singleRun: true
22+
});
23+
};

package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,19 @@
3737
"gulp-sequence": "^0.4.0",
3838
"gulp-sourcemaps": "^1.5.2",
3939
"gulp-uglify": "^1.2.0"
40+
},
41+
"devDependencies": {
42+
"angular": "^1.3.18",
43+
"angular-mocks": "^1.3.18",
44+
"chai": "^3.2.0",
45+
"karma": "^0.13.9",
46+
"karma-babel-preprocessor": "^5.2.1",
47+
"karma-chai": "^0.1.0",
48+
"karma-chai-sinon": "^0.1.5",
49+
"karma-mocha": "^0.2.0",
50+
"karma-phantomjs-launcher": "^0.2.1",
51+
"mocha": "^2.2.5",
52+
"phantomjs": "^1.9.18",
53+
"sinon-chai": "^2.8.0"
4054
}
4155
}

0 commit comments

Comments
 (0)