Skip to content

Commit

Permalink
override tests for saucelabs, itll be rebased anyway
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilogorek committed May 22, 2018
1 parent 9360b8e commit 579a47c
Show file tree
Hide file tree
Showing 14 changed files with 155 additions and 169 deletions.
117 changes: 0 additions & 117 deletions karma.sauce.config.js

This file was deleted.

13 changes: 0 additions & 13 deletions karma.unit.config.js

This file was deleted.

7 changes: 5 additions & 2 deletions karma.config.js → karma/karma.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

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

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
Expand Down Expand Up @@ -58,9 +58,12 @@ module.exports = {
}
},

// https://docs.travis-ci.com/user/gui-and-headless-browsers/#Karma-and-Firefox-inactivity-timeouts
browserNoActivityTimeout: 30000,

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

// Concurrency level
// how many browser should be started simultaneous
Expand Down
10 changes: 10 additions & 0 deletions karma/karma.integration-sauce.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var commonSauceConfig = require('./karma.sauce.config');
var files = require('./karma.integration.config').files;

module.exports = function(config) {
var testConfig = Object.assign({}, commonSauceConfig, {
logLevel: config.LOG_INFO,
files: files.concat(['build/raven.test.js'])
});
config.set(testConfig);
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ var testFiles = [
{pattern: 'test/integration/throw-object.js', included: false},
{pattern: 'test/integration/example.json', included: false},
{pattern: 'test/integration/frame.html', included: false},
'test/integration/test.js',
'test/globals.js',
'build/raven.js'
{pattern: 'build/raven.js', included: false},
'test/integration/test.js'
];

module.exports = function(config) {
var testConfig = Object.assign({}, commonConfig, {files: testFiles});
config.set(testConfig);
};

module.exports.files = testFiles;
10 changes: 10 additions & 0 deletions karma/karma.loader-sauce.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var commonSauceConfig = require('./karma.sauce.config');
var files = require('./karma.loader.config').files;

module.exports = function(config) {
var testConfig = Object.assign({}, commonSauceConfig, {
logLevel: config.LOG_INFO,
files: files
});
config.set(testConfig);
};
1 change: 1 addition & 0 deletions karma.loader.config.js → karma/karma.loader.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ module.exports = function(config) {
var testConfig = Object.assign({}, commonConfig, {files: testFiles});
config.set(testConfig);
};
module.exports.files = testFiles;
97 changes: 97 additions & 0 deletions karma/karma.sauce.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
var commonConfig = require('./karma.config');

var customLaunchers = {
sl_chrome: {
base: 'SauceLabs',
browserName: 'chrome',
platform: 'Windows 10',
version: 'latest'
},
sl_firefox: {
base: 'SauceLabs',
browserName: 'firefox',
platform: 'Windows 10',
version: 'latest'
},
sl_edge: {
base: 'SauceLabs',
browserName: 'microsoftedge',
version: 'latest',
platform: 'Windows 10'
},
sl_ie_11: {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 7',
version: '11'
},
sl_ie_10: {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 7',
version: '10'
},
sl_safari: {
base: 'SauceLabs',
browserName: 'safari',
platform: 'OS X 10.12',
version: '11.0'
},
sl_ios: {
base: 'SauceLabs',
browserName: 'iphone',
platform: 'OS X 10.12',
version: '11.0'
},
sl_android_7: {
base: 'SauceLabs',
browserName: 'Chrome',
platform: 'Android',
version: '7.1',
device: 'Android GoogleAPI Emulator'
},
sl_android_6: {
base: 'SauceLabs',
browserName: 'Chrome',
platform: 'Android',
version: '6.0',
device: 'Android Emulator'
},
sl_android_5: {
base: 'SauceLabs',
browserName: 'android',
platform: 'Linux',
version: '5.1'
},
sl_android_4: {
base: 'SauceLabs',
browserName: 'android',
platform: 'Linux',
version: '4.4'
}
};

module.exports = Object.assign({}, commonConfig, {
customLaunchers: customLaunchers,
browsers: Object.keys(customLaunchers),
reporters: ['failed', 'saucelabs'],
singleRun: true,
plugins: commonConfig.plugins.concat(['karma-sauce-launcher']),
build: process.env.TRAVIS_BUILD_NUMBER,
// SauceLabs allows for 2 tunnels only, therefore some browsers will have to wait
// rather long time. Plus mobile emulators tend to require a lot of time to start up.
// 10 minutes should be more than enough to run all of them.
browserNoActivityTimeout: 600000,
captureTimeout: 600000,
sauceLabs: {
startConnect: false,
// Just something "random" so we don't have to provide additional ENV var when running locally
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER || Math.ceil(Math.random() * 1337),
recordScreenshots: false,
recordVideo: false,
testName:
'Raven.js' +
(process.env.TRAVIS_JOB_NUMBER ? ' #' + process.env.TRAVIS_JOB_NUMBER : ''),
public: 'public'
}
});
9 changes: 9 additions & 0 deletions karma/karma.unit.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var commonConfig = require('./karma.config');

module.exports = function(config) {
var testConfig = Object.assign({}, commonConfig, {
logLevel: config.LOG_INFO,
files: ['build/raven.test.js']
});
config.set(testConfig);
};
16 changes: 7 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@
"lint": "eslint .",
"precommit": "lint-staged",
"publish": "grunt publish",
"test": "npm run lint && grunt build.test && npm run test:unit && npm run test:integration && npm run test:loader && npm run test:typescript",
"test:karma:unit": "karma start karma.unit.config.js",
"test:karma:integration": "karma start karma.integration.config.js ",
"test:karma:loader": "karma start karma.loader.config.js ",
"test:karma:sauce": "karma start karma.sauce.config.js ",
"test:unit": "npm run test:karma:unit -- --single-run",
"test:integration": "npm run test:karma:integration -- --single-run",
"test:loader": "npm run test:karma:loader -- --single-run",
"test": "npm run lint && grunt build.test && npm run test:unit && npm run test:loader && npm run test:integration && npm run test:typescript",
"test:unit": "karma start karma/karma.unit.config.js",
"test:integration": "karma start karma/karma.integration.config.js",
"test:integration-sauce": "karma start karma/karma.integration-sauce.config.js",
"test:loader": "karma start karma/karma.loader.config.js",
"test:loader-sauce": "karma start karma/karma.loader-sauce.config.js",
"test:typescript": "tsc --noEmit --noImplicitAny typescript/raven-tests.ts",
"test:ci": "npm run lint && grunt test:ci && npm run test:karma:sauce",
"test:ci": "npm run lint && grunt test:ci && npm run test:loader-sauce && npm run test:integration-sauce",
"test:size": "grunt dist && bundlesize && git checkout -- dist/"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@
// as raven.js file is pre-loaded and XHR will behave like a synchronous call
setTimeout(function() {
_currentScriptTag.parentNode.insertBefore(_newScriptTag, _currentScriptTag);
}, 100);
}, 500);
})(window, document, 'script', 'onerror', 'onunhandledrejection');
2 changes: 0 additions & 2 deletions test/globals.js

This file was deleted.

Loading

0 comments on commit 579a47c

Please sign in to comment.