Skip to content

Commit

Permalink
fix(travis-ci): fix Webgl rendering test fails on Travis CI (#228)
Browse files Browse the repository at this point in the history
* chore(travis): setting to test on travis ci
* chore(karma): add mocha as default test env
* chore(travis): set premultipliedAlpha = false
* And apply refactoring & formatting

Ref #225

Test Case
* test(PanoImageRenderer): add webglcontextrestore test.
Ref #228

Other

* chore(package): add homepage
* chore(package): update dev dependency as latest
  • Loading branch information
Jongmoon Yoon committed Aug 14, 2018
1 parent e404109 commit cb2e15f
Show file tree
Hide file tree
Showing 10 changed files with 15,601 additions and 15,024 deletions.
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"linebreak-style": 0,
"array-element-newline": "off",
"class-methods-use-this": "off"
},
"env": {
"mocha": true
}
}
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ before_install:
install:
- npm install
addons:
chrome: beta
chrome: stable
cache:
directories:
- "node_modules"
Expand Down
134 changes: 71 additions & 63 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,80 +1,88 @@
module.exports = function(config) {
var karmaConfig = {
frameworks: ["mocha", "chai", "sinon"],
module.exports = config => {
const karmaConfig = {
frameworks: ["mocha", "chai", "sinon"],

browserNoActivityTimeout: 60000,
browserNoActivityTimeout: 60000,

// list of files / patterns to load in the browser
files: [
"./node_modules/resemblejs/resemble.js",
"./node_modules/lite-fixture/index.js",
// list of files / patterns to load in the browser
files: [
"./node_modules/resemblejs/resemble.js",
"./node_modules/lite-fixture/index.js",
"./node_modules/hammer-simulator/index.js",
"./test/hammer-simulator.run.js",
"./test/unit/util.js",
"./test/unit/**/*.spec.js",
{pattern: "./test/manual/img/**/*.*", watched: false, included: false, served: true},
// {pattern: "./test/img/*.*", watched: false, included: false, served: true},
],
"./test/unit/**/*.spec.js",
{pattern: "./test/manual/img/**/*.*", watched: false, included: false, served: true},
// {pattern: "./test/img/*.*", watched: false, included: false, served: true},
],

proxies: {
"/images/": "/base/test/manual/img/"
"/images/": "/base/test/manual/img/"
},

client: {
mocha: {
opts: "./mocha.opts",
timeout: "20000"
}
},
client: {
mocha: {
opts: "./mocha.opts",
timeout: "20000"
}
},

webpack: {
webpack: {
devtool: "inline-source-map",
mode: "none",
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
}
]
}
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
}
]
}
},

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"./test/**/*.spec.js": config.coverage ? ["webpack"] : ["webpack", "sourcemap"]
},
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"./test/**/*.spec.js": config.coverage ? ["webpack"] : ["webpack", "sourcemap"]
},

browsers: [],
customLaunchers: {
ChromeHeadlessGL: {
base: 'ChromeHeadless',
flags: ['--disable-gpu', '--use-gl=osmesa']
}
},
reporters: ["mocha"],
webpackMiddleware: {
noInfo: true
}
};
browsers: [],
customLaunchers: {
ChromeHeadlessGL: {
base: "Chrome",
flags: [
"--headless",
"--hide-scrollbars",
"--mute-audio",
"--no-sandbox",
"--disable-setuid-sandbox",
// Without a remote debugging port, Google Chrome exits immediately.
"--remote-debugging-port=9222",
// Although --use-gl=osmesa is not specified. it need to install libosmesa in TRAVIS setting to test sucessfully
]
}
},
reporters: ["mocha"],
webpackMiddleware: {
noInfo: true
}
};

karmaConfig.browsers.push(config.chrome ? "Chrome" : "ChromeHeadlessGL");
karmaConfig.browsers.push(config.chrome ? "Chrome" : "ChromeHeadlessGL");

if(config.coverage) {
karmaConfig.reporters.push("coverage-istanbul");
karmaConfig.coverageIstanbulReporter = {
reports: ["text-summary", "html", "lcovonly"],
dir: "./coverage"
};
karmaConfig.webpack.module.rules.unshift({
test: /\.js$/,
exclude: /(node_modules|test)/,
loader: "istanbul-instrumenter-loader"
});
karmaConfig.singleRun = true;
}
if (config.coverage) {
karmaConfig.reporters.push("coverage-istanbul");
karmaConfig.coverageIstanbulReporter = {
reports: ["text-summary", "html", "lcovonly"],
dir: "./coverage"
};
karmaConfig.webpack.module.rules.unshift({
test: /\.js$/,
exclude: /(node_modules|test)/,
loader: "istanbul-instrumenter-loader"
});
karmaConfig.singleRun = true;
}

config.set(karmaConfig);
config.set(karmaConfig);
};
Loading

0 comments on commit cb2e15f

Please sign in to comment.