Skip to content

Commit

Permalink
fix: port over Travis CI updates from #1109 meant to improve the reli…
Browse files Browse the repository at this point in the history
…ability / consistency of the visual regression test results being run by Jest
  • Loading branch information
sghoweri committed Mar 26, 2019
1 parent 30872db commit 8f56a70
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ before_install:
services:
- docker

addons:
chrome: stable

# see more conditions: https://docs.travis-ci.com/user/conditions-v1
# Stages run sequentially; the jobs in them run in parallel
stages:
Expand Down
13 changes: 11 additions & 2 deletions jest-global-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const os = require('os');

const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');

const chromePath = require('@moonandyou/chrome-path');
const { buildPrep } = require('./packages/build-tools/tasks/task-collections');
const imageTasks = require('./packages/build-tools/tasks/image-tasks');
const iconTasks = require('./packages/build-tools/tasks/icon-tasks');
Expand All @@ -15,10 +16,14 @@ const teardown = require('./jest-global-teardown.js');

module.exports = async function globalSetup() {
let config = await getConfig();
const localChromePath = await chromePath();
const existingIconsDir =
typeof config.iconDir !== 'undefined' ? config.iconDir : [];

config.iconDir = [...existingIconsDir, path.join(__dirname, './test/jest-test-svgs')];
config.iconDir = [
...existingIconsDir,
path.join(__dirname, './test/jest-test-svgs'),
];

await buildPrep({ cleanAll: true }); // clear out all folders before running
await imageTasks.processImages(); // process image fixtures used by any tests
Expand All @@ -28,9 +33,13 @@ module.exports = async function globalSetup() {
command: `node packages/servers/testing-server`,
launchTimeout: 50000,
port: 4444,
usedPortAction: 'kill',
});

const browser = await puppeteer.launch();
const browser = await puppeteer.launch({
args: ['--no-sandbox', '--disable-setuid-sandbox'],
executablePath: localChromePath['google-chrome'],
});
// store the browser instance so we can teardown it later
// this global is only available in the teardown but not in TestEnvironments
global.__BROWSER_GLOBAL__ = browser;
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"semantic-release": "^15.13.3"
},
"dependencies": {
"@moonandyou/chrome-path": "^0.2.1",
"cli-highlight": "^2.0.0",
"babel-jest": "^24.5.0",
"@open-wc/testing-helpers": "^0.7.22",
Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,13 @@
mkdirp "^0.5.1"
rimraf "^2.5.2"

"@moonandyou/chrome-path@^0.2.1":
version "0.2.1"
resolved "https://registry.npmjs.org/@moonandyou/chrome-path/-/chrome-path-0.2.1.tgz#6c0856bb4ff86bcad0b4eb9ee5ffaece62b5f042"
integrity sha1-bAhWu0/4a8rQtOue5f+uzmK18EI=
dependencies:
lsregister "^0.0.1"

"@mrmlnc/readdir-enhanced@^2.2.1":
version "2.2.1"
resolved "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde"
Expand Down Expand Up @@ -10965,6 +10972,11 @@ lru-cache@^5.1.1:
dependencies:
yallist "^3.0.2"

lsregister@^0.0.1:
version "0.0.1"
resolved "https://registry.npmjs.org/lsregister/-/lsregister-0.0.1.tgz#ae52196808b736ba1c0c1f243a30501fa1dd8262"
integrity sha1-rlIZaAi3NrocDB8kOjBQH6HdgmI=

macos-release@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/macos-release/-/macos-release-2.0.0.tgz#7dddf4caf79001a851eb4fba7fb6034f251276ab"
Expand Down

0 comments on commit 8f56a70

Please sign in to comment.