Skip to content

Commit 23bbe89

Browse files
committed
chore(test): setup karma test runner against chrome browser
- initial bootstrap config for karma runner against chrome - ci server is not configured yet relates to #998
1 parent d22a14d commit 23bbe89

File tree

4 files changed

+91
-21
lines changed

4 files changed

+91
-21
lines changed

karma.conf.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Karma configuration
2+
// Generated on Tue Dec 08 2015 23:01:01 GMT-0800 (Pacific Standard Time)
3+
4+
module.exports = function (config) {
5+
config.set({
6+
7+
// base path that will be used to resolve all patterns (eg. files, exclude)
8+
basePath: '',
9+
10+
// frameworks to use
11+
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
12+
frameworks: ['browserify', 'jasmine'],
13+
14+
// list of files / patterns to load in the browser
15+
files: [
16+
'spec/helpers/marble-testing.js',
17+
'spec/helpers/test-helper.js',
18+
'spec/**/*-spec.js'
19+
],
20+
21+
// list of files to exclude
22+
exclude: [
23+
],
24+
25+
// preprocess matching files before serving them to the browser
26+
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
27+
preprocessors: {
28+
'spec/**/*.js': ['browserify']
29+
},
30+
31+
// test results reporter to use
32+
// possible values: 'dots', 'progress'
33+
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
34+
reporters: ['progress'],
35+
36+
// web server port
37+
port: 9876,
38+
39+
// enable / disable colors in the output (reporters and logs)
40+
colors: true,
41+
42+
// level of logging
43+
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
44+
logLevel: config.LOG_INFO,
45+
46+
// enable / disable watching file and executing tests whenever any file changes
47+
autoWatch: false,
48+
49+
// start these browsers
50+
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
51+
browsers: ['Chrome'],
52+
53+
// Continuous Integration mode
54+
// if true, Karma captures browsers, runs the tests and exits
55+
singleRun: true,
56+
57+
// Concurrency level
58+
// how many browser should be started simultanous
59+
concurrency: 1
60+
});
61+
};

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,13 @@
9898
"istanbul": "0.3.22",
9999
"jasmine": "2.4.1",
100100
"jasmine-core": "2.4.1",
101+
"karma": "0.13.15",
102+
"karma-browserify": "4.4.2",
103+
"karma-chrome-launcher": "0.2.2",
104+
"karma-jasmine": "0.3.6",
101105
"lodash": "3.10.1",
102-
"markdown-doctest": "^0.3.0",
103106
"madge": "^0.5.3",
107+
"markdown-doctest": "^0.3.0",
104108
"mkdirp": "^0.5.1",
105109
"platform": "1.3.0",
106110
"promise": "7.0.3",

spec/helpers/test-helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//Fail timeouts faster
22
//Individual suites/specs should specify longer timeouts if needed.
3-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
3+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;
44

55
var _ = require('lodash');
66
var root = require('../../dist/cjs/util/root').root;

spec/observables/from-promise-spec.js

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
/* globals describe, it, expect */
22
var Rx = require('../../dist/cjs/Rx');
33
var Observable = Rx.Observable;
4+
var isNode = typeof process === 'object' &&
5+
process + '' === '[object process]' &&
6+
typeof window === 'undefined';
47

58
describe('Observable.fromPromise', function () {
69
it('should emit one value from a resolved promise', function (done) {
@@ -109,24 +112,26 @@ describe('Observable.fromPromise', function () {
109112
});
110113
});
111114

112-
it('should globally throw unhandled errors', function (done) {
113-
var invoked = false;
114-
process.on('uncaughtException', function (reason, p) {
115-
if (invoked) {
116-
return;
117-
}
118-
invoked = true;
119-
expect(reason).toBe('fail');
120-
done();
121-
});
115+
if (isNode) {
116+
it('should globally throw unhandled errors on node', function (done) {
117+
var invoked = false;
118+
process.on('uncaughtException', function (reason, p) {
119+
if (invoked) {
120+
return;
121+
}
122+
invoked = true;
123+
expect(reason).toBe('fail');
124+
done();
125+
});
122126

123-
Observable.fromPromise(Promise.reject('bad'))
124-
.subscribe(
125-
done.fail,
126-
function (e) {
127-
expect(e).toBe('bad');
128-
throw 'fail';
129-
},
130-
done.fail);
131-
});
127+
Observable.fromPromise(Promise.reject('bad'))
128+
.subscribe(
129+
done.fail,
130+
function (e) {
131+
expect(e).toBe('bad');
132+
throw 'fail';
133+
},
134+
done.fail);
135+
});
136+
}
132137
});

0 commit comments

Comments
 (0)