Skip to content

Commit

Permalink
prettify + fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
JelteF committed Sep 17, 2018
1 parent e6ac477 commit d31b0b1
Show file tree
Hide file tree
Showing 56 changed files with 6,384 additions and 5,703 deletions.
135 changes: 67 additions & 68 deletions karma.ci.config.js
@@ -1,79 +1,78 @@
var baseConfig = require('./karma.config.js');

module.exports = function(config) {
baseConfig(config);

baseConfig(config);
var customLaunchers = {
SL_Chrome: {
base: 'SauceLabs',
browserName: 'chrome',
},
SL_FireFox: {
base: 'SauceLabs',
browserName: 'firefox',
},
SL_Safari: {
base: 'SauceLabs',
browserName: 'safari',
},
SL_IE_10: {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 8',
version: '10',
},
SL_IE_11: {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 8.1',
version: '11',
},
// 'SL_IE_13': {
// base: 'SauceLabs',
// browserName: 'microsoftedge',
// version: '13',
// platform: 'Windows 10',
// },
SL_IE_14: {
base: 'SauceLabs',
browserName: 'microsoftedge',
version: '14',
platform: 'Windows 10',
},
};

var customLaunchers = {
'SL_Chrome': {
base: 'SauceLabs',
browserName: 'chrome',
},
'SL_FireFox': {
base: 'SauceLabs',
browserName: 'firefox',
},
'SL_Safari': {
base: 'SauceLabs',
browserName: 'safari',
},
'SL_IE_10': {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 8',
version: '10',
},
'SL_IE_11': {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 8.1',
version: '11',
},
// 'SL_IE_13': {
// base: 'SauceLabs',
// browserName: 'microsoftedge',
// version: '13',
// platform: 'Windows 10',
// },
'SL_IE_14': {
base: 'SauceLabs',
browserName: 'microsoftedge',
version: '14',
platform: 'Windows 10',
},
};
config.set({
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
sauceLabs: {
testName: 'Stream-JS Browser Tests',
public: 'public',
connectOptions: {
// verbose: true,
// verboseDebugging: true,
},
},
customLaunchers: customLaunchers,
browsers: Object.keys(customLaunchers),

config.set({
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
sauceLabs: {
testName: 'Stream-JS Browser Tests',
public: "public",
connectOptions: {
// verbose: true,
// verboseDebugging: true,
}
},
customLaunchers: customLaunchers,
browsers: Object.keys(customLaunchers),
reporters: ['dots', 'saucelabs'],

reporters: ['dots', 'saucelabs'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
captureTimeout: 60000,
// Somehow karma doesn't capture intermediate behavior and only
// captures once an entire suite is complete. This timeout will
// guarantee that the browser will have enough time to do this:

captureTimeout: 60000,
// Somehow karma doesn't capture intermediate behavior and only
// captures once an entire suite is complete. This timeout will
// guarantee that the browser will have enough time to do this:
// Integration tests can take very long we will give the browser
// 300 seconds to complete these.
browserNoActivityTimeout: 300 * 1000,

// Integration tests can take very long we will give the browser
// 300 seconds to complete these.
browserNoActivityTimeout: 300 * 1000,

// Concurrency level
// how many browser should be started simultaneous
concurrency: 3
});
// Concurrency level
// how many browser should be started simultaneous
concurrency: 3,
});
};
140 changes: 69 additions & 71 deletions karma.config.js
Expand Up @@ -7,80 +7,78 @@ delete webpackConfig['entry'];
delete webpackConfig['output'];
webpackConfig['devtool'] = 'inline-source-map';
webpackConfig['plugins'] = [
new webpack.EnvironmentPlugin([
'STREAM_API_KEY',
'STREAM_API_SECRET',
'STREAM_APP_ID',
])
new webpack.EnvironmentPlugin([
'STREAM_API_KEY',
'STREAM_API_SECRET',
'STREAM_APP_ID',
]),
];
webpackConfig['node']['Buffer'] = true;
webpackConfig['module']['rules'].push({ test: /\.json$/, exclude:/node_modules/, loader: 'json-loader' });
webpackConfig['module']['rules'].push({
test: /\.json$/,
exclude: /node_modules/,
loader: 'json-loader',
});

// Karma config
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: ['mocha'],

// list of files / patterns to load in the browser
files: [
'test/unit/common/**/*_test.js',
'test/unit/browser/**/*_test.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: {
'test/unit/common/**/*_test.js': [ 'webpack', 'sourcemap' ],
'test/unit/browser/**/*_test.js': [ 'webpack', 'sourcemap' ],
},

// Webpack configuration for webpack preprocessor
webpack: webpackConfig,
webpackMiddleware: {
// webpack-dev-middleware configuration
// i. e.
stats: 'errors-only'
},

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

// 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: true,

// 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: false,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity,

});
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: ['mocha'],

// list of files / patterns to load in the browser
files: ['test/unit/common/**/*_test.js', 'test/unit/browser/**/*_test.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: {
'test/unit/common/**/*_test.js': ['webpack', 'sourcemap'],
'test/unit/browser/**/*_test.js': ['webpack', 'sourcemap'],
},

// Webpack configuration for webpack preprocessor
webpack: webpackConfig,
webpackMiddleware: {
// webpack-dev-middleware configuration
// i. e.
stats: 'errors-only',
},

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

// 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: true,

// 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: false,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity,
});
};
9 changes: 5 additions & 4 deletions src/getstream.js
Expand Up @@ -28,8 +28,10 @@ function connect(apiKey, apiSecret, appId, options) {
* @example <caption>where streamURL looks like</caption>
* "https://thierry:pass@gestream.io/?app=1"
*/
if (typeof (process) !== 'undefined' && process.env.STREAM_URL && !apiKey) {
var parts = /https\:\/\/(\w+)\:(\w+)\@([\w-]*).*\?app_id=(\d+)/.exec(process.env.STREAM_URL); // eslint-disable-line no-useless-escape
if (typeof process !== 'undefined' && process.env.STREAM_URL && !apiKey) {
var parts = /https\:\/\/(\w+)\:(\w+)\@([\w-]*).*\?app_id=(\d+)/.exec(
process.env.STREAM_URL
); // eslint-disable-line no-useless-escape
apiKey = parts[1];
apiSecret = parts[2];
var location = parts[3];
Expand All @@ -46,7 +48,7 @@ function connect(apiKey, apiSecret, appId, options) {
return new StreamClient(apiKey, apiSecret, appId, options);
}

function connectCloud(apiKey, appId, options={}) {
function connectCloud(apiKey, appId, options = {}) {
/**
* Create StreamCloudClient that's compatible with StreamCloud
* @method connect
Expand All @@ -68,7 +70,6 @@ function connectCloud(apiKey, appId, options={}) {
return new cloud.StreamCloudClient(apiKey, null, appId, options);
}


module.exports.connect = connect;
module.exports.connectCloud = connectCloud;
module.exports.errors = errors;
Expand Down

0 comments on commit d31b0b1

Please sign in to comment.