-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from pmmmwh/feat/test-suite
- Loading branch information
Showing
16 changed files
with
1,027 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
node: circleci/[email protected] | ||
|
||
commands: | ||
setup-headless-chromium: | ||
steps: | ||
- run: | ||
name: Install dependencies for headless Chromium | ||
command: | | ||
sudo apt-get update | ||
sudo apt-get install -yq \ | ||
gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \ | ||
libexpat1 libfontconfig1 libgbm1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 \ | ||
libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \ | ||
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \ | ||
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget | ||
- run: | ||
name: Setup sandboxing for Chromium | ||
command: sudo sysctl -w kernel.unprivileged_userns_clone=1 | ||
|
||
jobs: | ||
test: | ||
executor: | ||
name: node/default | ||
tag: << parameters.node-version >> | ||
parameters: | ||
node-version: | ||
default: '13.14' | ||
type: string | ||
setup: | ||
default: [] | ||
type: steps | ||
steps: | ||
- checkout | ||
- setup-headless-chromium | ||
- steps: << parameters.setup >> | ||
- node/install-packages: | ||
app-dir: ~/project | ||
pkg-manager: yarn | ||
with-cache: false | ||
- run: | ||
name: Run Tests | ||
command: yarn test | ||
working_directory: ~/project | ||
|
||
workflows: | ||
test-matrix: | ||
jobs: | ||
- test: | ||
name: test/node:10 | ||
node-version: '10.20' | ||
- test: | ||
name: test/node:12 | ||
node-version: '12.16' | ||
- test: | ||
name: test/node:13 | ||
node-version: '13.14' | ||
- test: | ||
name: test/node:14 | ||
node-version: '14.2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,6 @@ yarn-error.log* | |
# lockfiles | ||
package-lock.json | ||
/yarn.lock | ||
|
||
# test artifacts | ||
*__tmp__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = { | ||
globalSetup: '<rootDir>/jest-global-setup.js', | ||
globalTeardown: '<rootDir>/jest-global-teardown.js', | ||
modulePaths: [], | ||
rootDir: 'test', | ||
testEnvironment: '<rootDir>/jest-environment.js', | ||
testMatch: ['<rootDir>/**/*.test.js'], | ||
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Setup environment before any code - | ||
// this makes sure everything coming after will run in the correct env. | ||
process.env.NODE_ENV = 'test'; | ||
|
||
// Crash on unhandled rejections instead of failing silently. | ||
process.on('unhandledRejection', (error) => { | ||
throw error; | ||
}); | ||
|
||
const jest = require('jest'); | ||
const yn = require('yn'); | ||
|
||
let argv = process.argv.slice(2); | ||
|
||
if (yn(process.env.CI)) { | ||
// Force headless mode in CI environments | ||
process.env.HEADLESS = 'true'; | ||
|
||
// Use CI mode | ||
argv.push('--ci'); | ||
// Parallelized puppeteer tests have high memory overhead in CI environments. | ||
// Fall back to run in series so tests will run faster. | ||
argv.push('--runInBand'); | ||
} | ||
|
||
if (yn(process.env.DEBUG)) { | ||
argv.push('--verbose'); | ||
} | ||
|
||
void jest.run(argv); |
Oops, something went wrong.