unify the puppeteer test scripts

This commit is contained in:
Brian Hicks 2023-05-03 14:25:39 -05:00
parent 0ed9380044
commit fb8b19a6d8
No known key found for this signature in database
GPG Key ID: C4F324B9CAAB0D50
4 changed files with 17 additions and 15 deletions

View File

@ -124,15 +124,12 @@ main = do
cmd (WithStdout True) (FileStdout out) "./node_modules/.bin/prettier" "--check" jsFiles
"log/puppeteer-tests.txt" %> \out -> do
percyToken <- getEnv "PERCY_TOKEN"
case percyToken of
Nothing -> do
writeFileChanged out "PERCY_TOKEN not set, so skipping visual diff testing."
need ["log/npm-install.txt", "log/public.txt"]
cmd (WithStdout True) (FileStdout out) "script/puppeteer-tests-no-percy.sh"
Just _ -> do
need ["log/npm-install.txt", "log/public.txt"]
cmd (WithStdout True) (FileStdout out) "script/puppeteer-tests-percy.sh"
-- `getEnv` looks like a no-op, but it actually makes Shake pay
-- attention to this variable so that if it changes this command will be
-- re-run with the new token.
getEnv "PERCY_TOKEN"
need ["log/npm-install.txt", "log/public.txt"]
cmd (WithStdout True) (FileStdout out) "script/puppeteer-tests.sh"
"log/forbidden-imports-report.txt" %> \out -> do
need ["forbidden-imports.toml"]

View File

@ -1,3 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
env ONLYDOODAD=${1-default} npx mocha script/puppeteer-tests.js --timeout 25000 --exit

View File

@ -1,3 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
env ONLYDOODAD=${1-default} npx percy exec -- mocha script/puppeteer-tests.js --timeout 100000 --exit

11
script/puppeteer-tests.sh Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -euo pipefail
export ONLYDOODAD=${1:-default}
if test -n "${PERCY_TOKEN:-}"; then
npx percy exec -- mocha script/puppeteer-tests.js --timeout 100000 --exit
else
echo "PERCY_TOKEN not set, so skipping visual diff testing."
npx mocha script/puppeteer-tests.js --timeout 25000 --exit
fi