Skip to content

Commit c4da528

Browse files
committed
Karma added
1 parent 0dd634b commit c4da528

File tree

4 files changed

+81
-4
lines changed

4 files changed

+81
-4
lines changed

.travis.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ notifications:
99
email: false
1010
install:
1111
- npm install
12-
- npm install -g bower
13-
- bower install
12+
script:
13+
- npm run test
14+
- npm run test-browser

karma.conf.js

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Karma configuration
2+
3+
module.exports = function (config) {
4+
config.set({
5+
// frameworks to use
6+
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
7+
frameworks: ['browserify', 'mocha'],
8+
9+
10+
// list of files / patterns to load in the browser
11+
files: [
12+
'test/**/*.js'
13+
],
14+
15+
preprocessors: {
16+
'test/**/*.js': [ 'browserify' ]
17+
},
18+
19+
20+
// list of files to exclude
21+
exclude: [],
22+
23+
plugins: [
24+
'karma-mocha',
25+
'karma-chrome-launcher',
26+
'karma-phantomjs-launcher',
27+
'karma-browserify',
28+
'karma-spec-reporter'
29+
],
30+
31+
browserify: {
32+
debug: true
33+
},
34+
35+
36+
// test results reporter to use
37+
// possible values: 'dots', 'progress'
38+
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
39+
reporters: ['spec'],
40+
41+
42+
// web server port
43+
port: 9876,
44+
45+
46+
// enable / disable colors in the output (reporters and logs)
47+
colors: true,
48+
49+
50+
// level of logging
51+
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
52+
logLevel: config.LOG_INFO,
53+
54+
55+
// enable / disable watching file and executing tests whenever any file changes
56+
autoWatch: true,
57+
58+
59+
// start these browsers
60+
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
61+
browsers: ['PhantomJS'],
62+
63+
64+
// Continuous Integration mode
65+
// if true, Karma captures browsers, runs the tests and exits
66+
singleRun: true
67+
});
68+
};

package.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"compile": "browserify -s Acl -r ./src/index.js -o ./dist/acl.js",
88
"bower": "bower",
99
"test": "mocha",
10+
"test-browser": "karma start",
1011
"coverage": "istanbul cover _mocha -- -u exports -R nyan"
1112
},
1213
"repository": {
@@ -29,6 +30,13 @@
2930
"browserify": "^13.0.1",
3031
"chai": "^3.5.0",
3132
"istanbul": "^0.4.3",
32-
"mocha": "^2.5.3"
33+
"karma": "^0.13.22",
34+
"karma-browserify": "^5.0.5",
35+
"karma-chrome-launcher": "^0.2.0",
36+
"karma-mocha": "^1.0.1",
37+
"karma-phantomjs-launcher": "^0.2.1",
38+
"karma-spec-reporter": "0.0.26",
39+
"mocha": "^2.5.3",
40+
"phantomjs": "^1.9.18"
3341
}
3442
}

test/acl.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
var Acl = require(__dirname + '/../dist/acl');
3+
var Acl = require('../src');
44
var expect = require('chai').expect;
55

66
describe('Acl', function () {

0 commit comments

Comments
 (0)