Skip to content

Commit

Permalink
chore(test): setup karma test runner against chrome browser
Browse files Browse the repository at this point in the history
- initial bootstrap config for karma runner against chrome
- ci server is not configured yet

relates to ReactiveX#998
  • Loading branch information
kwonoj committed Dec 9, 2015
1 parent d22a14d commit 23bbe89
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 21 deletions.
61 changes: 61 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Karma configuration
// Generated on Tue Dec 08 2015 23:01:01 GMT-0800 (Pacific Standard Time)

module.exports = function (config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['browserify', 'jasmine'],

// list of files / patterns to load in the browser
files: [
'spec/helpers/marble-testing.js',
'spec/helpers/test-helper.js',
'spec/**/*-spec.js'
],

// list of files to exclude
exclude: [
],

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'spec/**/*.js': ['browserify']
},

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],

// web server port
port: 9876,

// enable / disable colors in the output (reporters and logs)
colors: true,

// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,

// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,

// Concurrency level
// how many browser should be started simultanous
concurrency: 1
});
};
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,13 @@
"istanbul": "0.3.22",
"jasmine": "2.4.1",
"jasmine-core": "2.4.1",
"karma": "0.13.15",
"karma-browserify": "4.4.2",
"karma-chrome-launcher": "0.2.2",
"karma-jasmine": "0.3.6",
"lodash": "3.10.1",
"markdown-doctest": "^0.3.0",
"madge": "^0.5.3",
"markdown-doctest": "^0.3.0",
"mkdirp": "^0.5.1",
"platform": "1.3.0",
"promise": "7.0.3",
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/test-helper.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//Fail timeouts faster
//Individual suites/specs should specify longer timeouts if needed.
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;

var _ = require('lodash');
var root = require('../../dist/cjs/util/root').root;
Expand Down
43 changes: 24 additions & 19 deletions spec/observables/from-promise-spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/* globals describe, it, expect */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;
var isNode = typeof process === 'object' &&
process + '' === '[object process]' &&
typeof window === 'undefined';

describe('Observable.fromPromise', function () {
it('should emit one value from a resolved promise', function (done) {
Expand Down Expand Up @@ -109,24 +112,26 @@ describe('Observable.fromPromise', function () {
});
});

it('should globally throw unhandled errors', function (done) {
var invoked = false;
process.on('uncaughtException', function (reason, p) {
if (invoked) {
return;
}
invoked = true;
expect(reason).toBe('fail');
done();
});
if (isNode) {
it('should globally throw unhandled errors on node', function (done) {
var invoked = false;
process.on('uncaughtException', function (reason, p) {
if (invoked) {
return;
}
invoked = true;
expect(reason).toBe('fail');
done();
});

Observable.fromPromise(Promise.reject('bad'))
.subscribe(
done.fail,
function (e) {
expect(e).toBe('bad');
throw 'fail';
},
done.fail);
});
Observable.fromPromise(Promise.reject('bad'))
.subscribe(
done.fail,
function (e) {
expect(e).toBe('bad');
throw 'fail';
},
done.fail);
});
}
});

0 comments on commit 23bbe89

Please sign in to comment.