Skip to content

Commit

Permalink
test(mux-player): Add saucelabs testing to default test npm script. E…
Browse files Browse the repository at this point in the history
…arly exit process if no saucelabs creds found.
  • Loading branch information
cjpillsbury committed Sep 24, 2024
1 parent 9fc5d7a commit 1fa7352
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/mux-player/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
"clean": "shx rm -rf dist/ && shx rm -rf src/polyfills",
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint src/ --ext .js,.jsx,.ts,.tsx",
"test:saucelabs": "web-test-runner **/*test.js --port 8001 --coverage --config test/web-test-runner.saucelabs.config.mjs --root-dir ../..",
"test": "web-test-runner **/*test.js --port 8001 --coverage --config test/web-test-runner.config.mjs --root-dir ../..",
"test:local": "web-test-runner **/*test.js --port 8001 --coverage --config test/web-test-runner.config.mjs --root-dir ../..",
"test": "yarn test:local && yarn test:saucelabs",
"posttest": "replace 'SF:src/' 'SF:packages/mux-player/src/' coverage/lcov.info --silent",
"i18n": "yarn build:esm --keep-names && i18n-utils dist/index.mjs ./lang",
"dev:iife": "yarn build:iife --watch=forever",
Expand Down
8 changes: 8 additions & 0 deletions packages/mux-player/test/web-test-runner.saucelabs.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import { importMapsPlugin } from '@web/dev-server-import-maps';
import { createSauceLabsLauncher } from '@web/test-runner-saucelabs';
import { legacyPlugin } from '@web/dev-server-legacy';

const user = process.env.SAUCE_USERNAME;
const key = process.env.SAUCE_ACCESS_KEY;

if (!(user && key)) {
console.warn('No saucelabs credentials available in this environment. Skipping');
process.exit(1);
}

// configure the local Sauce Labs proxy, use the returned function to define the
// browsers to test
const sauceLabsLauncher = createSauceLabsLauncher({
Expand Down

0 comments on commit 1fa7352

Please sign in to comment.