Skip to content

Commit 579a47c

Browse files
committed
override tests for saucelabs, itll be rebased anyway
1 parent 9360b8e commit 579a47c

14 files changed

+155
-169
lines changed

karma.sauce.config.js

-117
This file was deleted.

karma.unit.config.js

-13
This file was deleted.

karma.config.js renamed to karma/karma.config.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

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

88
// frameworks to use
99
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
@@ -58,9 +58,12 @@ module.exports = {
5858
}
5959
},
6060

61+
// https://docs.travis-ci.com/user/gui-and-headless-browsers/#Karma-and-Firefox-inactivity-timeouts
62+
browserNoActivityTimeout: 30000,
63+
6164
// Continuous Integration mode
6265
// if true, Karma captures browsers, runs the tests and exits
63-
singleRun: false,
66+
singleRun: true,
6467

6568
// Concurrency level
6669
// how many browser should be started simultaneous
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var commonSauceConfig = require('./karma.sauce.config');
2+
var files = require('./karma.integration.config').files;
3+
4+
module.exports = function(config) {
5+
var testConfig = Object.assign({}, commonSauceConfig, {
6+
logLevel: config.LOG_INFO,
7+
files: files.concat(['build/raven.test.js'])
8+
});
9+
config.set(testConfig);
10+
};

karma.integration.config.js renamed to karma/karma.integration.config.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ var testFiles = [
99
{pattern: 'test/integration/throw-object.js', included: false},
1010
{pattern: 'test/integration/example.json', included: false},
1111
{pattern: 'test/integration/frame.html', included: false},
12-
'test/integration/test.js',
13-
'test/globals.js',
14-
'build/raven.js'
12+
{pattern: 'build/raven.js', included: false},
13+
'test/integration/test.js'
1514
];
1615

1716
module.exports = function(config) {
1817
var testConfig = Object.assign({}, commonConfig, {files: testFiles});
1918
config.set(testConfig);
2019
};
20+
21+
module.exports.files = testFiles;

karma/karma.loader-sauce.config.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var commonSauceConfig = require('./karma.sauce.config');
2+
var files = require('./karma.loader.config').files;
3+
4+
module.exports = function(config) {
5+
var testConfig = Object.assign({}, commonSauceConfig, {
6+
logLevel: config.LOG_INFO,
7+
files: files
8+
});
9+
config.set(testConfig);
10+
};

karma.loader.config.js renamed to karma/karma.loader.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ module.exports = function(config) {
1212
var testConfig = Object.assign({}, commonConfig, {files: testFiles});
1313
config.set(testConfig);
1414
};
15+
module.exports.files = testFiles;

karma/karma.sauce.config.js

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
var commonConfig = require('./karma.config');
2+
3+
var customLaunchers = {
4+
sl_chrome: {
5+
base: 'SauceLabs',
6+
browserName: 'chrome',
7+
platform: 'Windows 10',
8+
version: 'latest'
9+
},
10+
sl_firefox: {
11+
base: 'SauceLabs',
12+
browserName: 'firefox',
13+
platform: 'Windows 10',
14+
version: 'latest'
15+
},
16+
sl_edge: {
17+
base: 'SauceLabs',
18+
browserName: 'microsoftedge',
19+
version: 'latest',
20+
platform: 'Windows 10'
21+
},
22+
sl_ie_11: {
23+
base: 'SauceLabs',
24+
browserName: 'internet explorer',
25+
platform: 'Windows 7',
26+
version: '11'
27+
},
28+
sl_ie_10: {
29+
base: 'SauceLabs',
30+
browserName: 'internet explorer',
31+
platform: 'Windows 7',
32+
version: '10'
33+
},
34+
sl_safari: {
35+
base: 'SauceLabs',
36+
browserName: 'safari',
37+
platform: 'OS X 10.12',
38+
version: '11.0'
39+
},
40+
sl_ios: {
41+
base: 'SauceLabs',
42+
browserName: 'iphone',
43+
platform: 'OS X 10.12',
44+
version: '11.0'
45+
},
46+
sl_android_7: {
47+
base: 'SauceLabs',
48+
browserName: 'Chrome',
49+
platform: 'Android',
50+
version: '7.1',
51+
device: 'Android GoogleAPI Emulator'
52+
},
53+
sl_android_6: {
54+
base: 'SauceLabs',
55+
browserName: 'Chrome',
56+
platform: 'Android',
57+
version: '6.0',
58+
device: 'Android Emulator'
59+
},
60+
sl_android_5: {
61+
base: 'SauceLabs',
62+
browserName: 'android',
63+
platform: 'Linux',
64+
version: '5.1'
65+
},
66+
sl_android_4: {
67+
base: 'SauceLabs',
68+
browserName: 'android',
69+
platform: 'Linux',
70+
version: '4.4'
71+
}
72+
};
73+
74+
module.exports = Object.assign({}, commonConfig, {
75+
customLaunchers: customLaunchers,
76+
browsers: Object.keys(customLaunchers),
77+
reporters: ['failed', 'saucelabs'],
78+
singleRun: true,
79+
plugins: commonConfig.plugins.concat(['karma-sauce-launcher']),
80+
build: process.env.TRAVIS_BUILD_NUMBER,
81+
// SauceLabs allows for 2 tunnels only, therefore some browsers will have to wait
82+
// rather long time. Plus mobile emulators tend to require a lot of time to start up.
83+
// 10 minutes should be more than enough to run all of them.
84+
browserNoActivityTimeout: 600000,
85+
captureTimeout: 600000,
86+
sauceLabs: {
87+
startConnect: false,
88+
// Just something "random" so we don't have to provide additional ENV var when running locally
89+
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER || Math.ceil(Math.random() * 1337),
90+
recordScreenshots: false,
91+
recordVideo: false,
92+
testName:
93+
'Raven.js' +
94+
(process.env.TRAVIS_JOB_NUMBER ? ' #' + process.env.TRAVIS_JOB_NUMBER : ''),
95+
public: 'public'
96+
}
97+
});

karma/karma.unit.config.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var commonConfig = require('./karma.config');
2+
3+
module.exports = function(config) {
4+
var testConfig = Object.assign({}, commonConfig, {
5+
logLevel: config.LOG_INFO,
6+
files: ['build/raven.test.js']
7+
});
8+
config.set(testConfig);
9+
};

package.json

+7-9
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,14 @@
1919
"lint": "eslint .",
2020
"precommit": "lint-staged",
2121
"publish": "grunt publish",
22-
"test": "npm run lint && grunt build.test && npm run test:unit && npm run test:integration && npm run test:loader && npm run test:typescript",
23-
"test:karma:unit": "karma start karma.unit.config.js",
24-
"test:karma:integration": "karma start karma.integration.config.js ",
25-
"test:karma:loader": "karma start karma.loader.config.js ",
26-
"test:karma:sauce": "karma start karma.sauce.config.js ",
27-
"test:unit": "npm run test:karma:unit -- --single-run",
28-
"test:integration": "npm run test:karma:integration -- --single-run",
29-
"test:loader": "npm run test:karma:loader -- --single-run",
22+
"test": "npm run lint && grunt build.test && npm run test:unit && npm run test:loader && npm run test:integration && npm run test:typescript",
23+
"test:unit": "karma start karma/karma.unit.config.js",
24+
"test:integration": "karma start karma/karma.integration.config.js",
25+
"test:integration-sauce": "karma start karma/karma.integration-sauce.config.js",
26+
"test:loader": "karma start karma/karma.loader.config.js",
27+
"test:loader-sauce": "karma start karma/karma.loader-sauce.config.js",
3028
"test:typescript": "tsc --noEmit --noImplicitAny typescript/raven-tests.ts",
31-
"test:ci": "npm run lint && grunt test:ci && npm run test:karma:sauce",
29+
"test:ci": "npm run lint && grunt test:ci && npm run test:loader-sauce && npm run test:integration-sauce",
3230
"test:size": "grunt dist && bundlesize && git checkout -- dist/"
3331
},
3432
"devDependencies": {

src/loader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,5 @@
7474
// as raven.js file is pre-loaded and XHR will behave like a synchronous call
7575
setTimeout(function() {
7676
_currentScriptTag.parentNode.insertBefore(_newScriptTag, _currentScriptTag);
77-
}, 100);
77+
}, 500);
7878
})(window, document, 'script', 'onerror', 'onunhandledrejection');

test/globals.js

-2
This file was deleted.

0 commit comments

Comments
 (0)