Skip to content

Commit 0c42c23

Browse files
committed
Working tests in Docker environment
* Install Chrome Headless during Docker build * Use Chrome Headless if in a Docker environment (same configuration as in CI)
1 parent 0bc8329 commit 0c42c23

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
FROM node:8.10
22

3+
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
4+
RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
5+
RUN apt-get update && apt-get install -y google-chrome-stable
6+
37
RUN echo '{"allow_root": true}' > /root/.bowerrc
48

59
WORKDIR /app

karma.conf.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/* eslint-disable import/unambiguous */
33
/* eslint-disable import/no-commonjs */
44

5+
const isDocker = require('is-docker');
56
const webpackConfiguration = require('./webpack.config.js');
67

78
const isCi = Boolean(process.env.TRAVIS);
@@ -76,7 +77,7 @@ module.exports = function(config) {
7677

7778
reporters: ['dots', 'BrowserStack'],
7879
});
79-
} else if (isCi) {
80+
} else if (isCi || isDocker()) {
8081
config.set({
8182
browsers: ['ChromeHeadlessNoSandbox'],
8283
customLaunchers: {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@
268268
"immutable-devtools": "0.1.3",
269269
"imports-loader": "^0.8.0",
270270
"inline-chunk-manifest-html-webpack-plugin": "^2.0.0",
271+
"is-docker": "^1.1.0",
271272
"json-loader": "^0.5.4",
272273
"karma": "^2.0.0",
273274
"karma-browserstack-launcher": "^1.1.1",

yarn.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5438,6 +5438,10 @@ is-directory@^0.3.1:
54385438
version "0.3.1"
54395439
resolved "https://registry.yarnpkg.com/is-directory/-/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1"
54405440

5441+
is-docker@^1.1.0:
5442+
version "1.1.0"
5443+
resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-1.1.0.tgz#f04374d4eee5310e9a8e113bf1495411e46176a1"
5444+
54415445
is-dotfile@^1.0.0:
54425446
version "1.0.3"
54435447
resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1"

0 commit comments

Comments
 (0)