☕️ Classic, reliable, trusted test framework for Node.js and the browser
run browser tests on GHA
Christopher Hiller025fc2e5a2b5
diff --git a/.github/workflows/mocha.yml b/.github/workflows/mocha.ymlindex 8cf1ecc4..4625ff68 100644--- a/.github/workflows/mocha.yml+++ b/.github/workflows/mocha.yml@@ -198,3 +198,29 @@ jobs:uses: coverallsapp/github-action@masterwith:github-token: '${{ secrets.GITHUB_TOKEN }}'+ test-browser:+ # TODO: configure to retain build artifacts in `.karma/` dir+ name: 'Browser Tests'+ needs: smoke+ runs-on: ubuntu-latest+ steps:+ - uses: actions/setup-node@v1+ with:+ node-version: 14+ - uses: actions/checkout@v2+ - name: 'Cache node_modules'+ uses: actions/cache@v2+ with:+ path: '~/.npm'+ # this key is different than above, since we are running scripts+ # (builds, postinstall lifecycle hooks, etc.)+ key: "ubuntu-latest-node-full-v14-${{ hashFiles('**/package-lock.json') }}"+ restore-keys: |+ ubuntu-latest-node-full-v14-+ - name: Install Dependencies+ run: npm ci+ - name: Run Browser Tests+ run: npm start test.browser+ env:+ SAUCE_USERNAME: '${{secrets.SAUCE_USERNAME}}'+ SAUCE_ACCESS_KEY: '${{secrets.SAUCE_ACCESS_KEY}}'diff --git a/.travis.yml b/.travis.ymldeleted file mode 100644index e89a15a3..00000000--- a/.travis.yml+++ /dev/null@@ -1,46 +0,0 @@-###-### .travis.yml-###--# these are executed in order. each must pass for the next to be run-stages:- - test # all tests--# defaults-language: node_js-node_js: '12'-# `nvm install` happens before the cache is restored, which means-# we must install our own npm elsewhere (`~/npm`)-before_install: |- [[ ! -x ~/npm/node_modules/.bin/npm ]] && {- # caching feature creates `~/npm` for us- cd ~/npm && npm install npm- cd -- } || true- # avoids bugs around https://github.com/travis-ci/travis-ci/issues/5092- export PATH=~/npm/node_modules/.bin:$PATH-# this avoids compilation in most cases (where we don't need it)-install: npm ci-cache:- directories:- - ~/.npm # cache npm's cache- - ~/npm # cache latest npm--jobs:- include:- - script: npm start test.browser- name: 'Browser'- node_js: 12- addons:- artifacts:- paths:- - .karma/- - ./mocha.js- chrome: stable- sauce_connect: true--env:- - 'NODE_OPTIONS="--trace-warnings"'--notifications:- email: falsediff --git a/karma.conf.js b/karma.conf.jsindex 8379c1bc..ef150e63 100644--- a/karma.conf.js+++ b/karma.conf.js@@ -86,22 +86,13 @@ module.exports = config => {// configuration for CI modeif (env.CI) {console.error('CI mode enabled');- if (env.TRAVIS) {- console.error('Travis-CI detected');- bundleDirPath = path.join(BASE_BUNDLE_DIR_PATH, env.TRAVIS_BUILD_ID);- if (env.SAUCE_USERNAME && env.SAUCE_ACCESS_KEY) {- // correlate build/tunnel with Travis- sauceConfig = {- build: `TRAVIS #${env.TRAVIS_BUILD_NUMBER} (${env.TRAVIS_BUILD_ID})`,- tunnelIdentifier: env.TRAVIS_JOB_NUMBER,- startConnect: false- };- console.error('Configured SauceLabs');- } else {- console.error('No SauceLabs credentials present');- }- } else if (env.APPVEYOR) {- throw new Error('no browser tests should run on AppVeyor!');+ if (env.GITHUB_RUN_ID) {+ console.error('Github Actions detected');+ bundleDirPath = path.join(+ BASE_BUNDLE_DIR_PATH,+ `github-${env.GITHUB_RUN_ID}_${env.GITHUB_RUN_NUMBER}`+ );+ sauceConfig = {};} else {console.error(`Local environment (${hostname}) detected`);// don't need to run sauce from Windows CI b/c travis does it.@@ -109,12 +100,13 @@ module.exports = config => {const id = `${hostname} (${Date.now()})`;sauceConfig = {build: id,- tunnelIdentifier: id,- startConnect: true+ tunnelIdentifier: id};console.error('Configured SauceLabs');} else {- console.error('No SauceLabs credentials present');+ console.error(+ 'No SauceLabs credentials present; set SAUCE_USERNAME and SAUCE_ACCESS_KEY env vars'+ );}}}@@ -199,16 +191,7 @@ const addSauceTests = (cfg, sauceLabs) => {...cfg.customLaunchers,...customLaunchers},- sauceLabs: {- ...sauceLabs,- public: 'public',- connectOptions: {- connectRetries: 2,- connectRetryTimeout: 30000,- detached: sauceLabs.startConnect,- tunnelIdentifier: sauceLabs.tunnelIdentifier- }- },+ sauceLabs,concurrency: Infinity,retryLimit: 1,captureTimeout: 120000,