Use a proxy with firefox to avoid loading external files in the examples test.
MODIFY
karma-base.js
karma-base.js
@@ -183,7 +183,8 @@ var notes_middleware = function (config) {
};
};
-module.exports = {
+module.exports = function (config) {
+ var newConfig = {
autoWatch: false,
files: [
test_case,
@@ -202,6 +203,15 @@ module.exports = {
browsers: [
'PhantomJS'
],
+ customLaunchers: {
+ FirefoxWithProxy: {
+ base: 'Firefox',
+ prefs: {
+ 'network.proxy.type': 2,
+ 'network.proxy.autoconfig_url': config.protocol + '//' + config.hostname + ':' + config.port + '/testdata/proxy-for-tests.pac'
+ }
+ }
+ },
browserNoActivityTimeout: 30000,
reporters: [
'progress',
@@ -228,5 +238,7 @@ module.exports = {
plugins: webpack_config.exposed_plugins
}
};
+ newConfig.preprocessors[test_case] = ['webpack', 'sourcemap'];
-module.exports.preprocessors[test_case] = ['webpack', 'sourcemap'];
+ return newConfig;
+};

MODIFY
karma-cov.conf.js
karma-cov.conf.js
// with coverage support.
var path = require('path');
-var karma_config = require('./karma-base');
/**
* Return URL friendly browser string
@@ -11,6 +10,9 @@ function browser(b) {
return b.toLowerCase().split(/[ /-]/)[0];
}
+module.exports = function (config) {
+ var karma_config = require('./karma-base')(config);
+
karma_config.reporters = ['progress', 'coverage'];
karma_config.coverageReporter = {
reporters: [
@@ -29,6 +31,5 @@ karma_config.webpack.module.preLoaders = [
}
];
-module.exports = function (config) {
config.set(karma_config);
};

MODIFY
karma.conf.js
karma.conf.js
-var karma_config = require('./karma-base');
-
module.exports = function (config) {
- config.set(karma_config);
+ config.set(require('./karma-base')(config));
};

MODIFY
package.json
package.json
"start": "karma start karma.conf.js",
"ci": "GEOJS_TEST_CASE=tests/test-unit.js karma start karma-cov.conf.js --single-run --browsers PhantomJS",
"ffci": "GEOJS_TEST_CASE=tests/test-gl.js karma start karma-cov.conf.js --single-run --browsers Firefox",
- "examplesci": "GEOJS_TEST_CASE=tests/test-examples.js karma start karma-cov.conf.js --single-run --browsers Firefox",
+ "examplesci": "GEOJS_TEST_CASE=tests/test-examples.js karma start karma-cov.conf.js --single-run --browsers FirefoxWithProxy",
"test-webgl": "GEOJS_TEST_CASE=tests/test-gl.js xvfb-run -s '-ac -screen 0 1280x1024x24' karma start karma-cov.conf.js --single-run --browsers Firefox",
- "test-examples": "GEOJS_TEST_CASE=tests/test-examples.js xvfb-run -s '-ac -screen 0 1280x1024x24' karma start karma-cov.conf.js --single-run --browsers Firefox",
+ "test-examples": "GEOJS_TEST_CASE=tests/test-examples.js xvfb-run -s '-ac -screen 0 1280x1024x24' karma start karma-cov.conf.js --single-run --browsers FirefoxWithProxy",
"codecov": "cat lcov/*/lcov.info | codecov",
"combine-coverage": "istanbul-combine -d dist/cobertura -r cobertura 'dist/coverage/json/**/coverage-final.json'",
"examples": "webpack-dev-server --config webpack-examples.config.js --host ${HOST-127.0.0.1} --port ${PORT-8082} --content-base dist/",

MODIFY
testing/test-data/base-images.tgz.md5
testing/test-data/base-images.tgz.md5
-3a85dd50f321e7ac897b416eade4a5ab
\ No newline at end of file
+2f4ea11110deac8f5de053c49d09ce1e
\ No newline at end of file

MODIFY
testing/test-data/base-images.tgz.url
testing/test-data/base-images.tgz.url
-https://data.kitware.com/api/v1/file/586ba6ed8d777f05f44a57d1/download
\ No newline at end of file
+https://data.kitware.com/api/v1/file/586bfea38d777f05f44a5c6f/download
\ No newline at end of file

ADD
tests/data/proxy-for-tests.pac
+function FindProxyForURL(url, host) {
+ // Don't serve certain remote addresses
+ if (dnsDomainIs(host, "fonts.googleapis.com")) {
+ return "PROXY http://192.0.2.0";
+ }
+ return "DIRECT";
+}

MODIFY
tests/test-examples.js
tests/test-examples.js
/**
- * Entry point for all tests in ./gl-cases/*
+ * Entry point for all tests in ./example-cases/*
* This is here to prevent webpack from creating a seperate bundle for each
* test case. See: https://github.com/webpack/karma-webpack/issues/23
*/

Use a proxy with firefox to avoid loading external files in the examples test.