veilid/veilid-wasm/wasm_test.sh
Derrick Oswald 15e4b75986 allow testing with Firefox snap
The snap version of Firefox cannot write to the /tmp location.
Recommended workaround is to set TMPDIR environment variable to location that both geckodriver and firefox can write to e.g. $HOME/tmp.
See https://github.com/mozilla/geckodriver/releases/tag/v0.31.0 and https://github.com/mozilla/geckodriver/issues/2010

This change adds the TMPDIR environment to allow testing with the Snap version of Firefox.
The downside is a possibly orphan directory (~/tmp) containing geckodriver and v8-compile-cache-1000.
2023-09-29 10:33:04 +02:00

25 lines
545 B
Bash
Executable File

#!/bin/bash
set -eo pipefail
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
pushd "$SCRIPTDIR" &> /dev/null
WASM_PACK_FLAGS="--dev"
if [[ "$1" == "release" ]]; then
WASM_PACK_FLAGS="--release"
fi
# Build wasm into an npm package, output into ./pkg
wasm-pack build $WASM_PACK_FLAGS --target bundler --weak-refs
# Install test deps and run test suite
cd tests
npm install
original_tmpdir=$TMPDIR
mkdir --parents ~/tmp
export TMPDIR=~/tmp
npm run test:headless
export TMPDIR=$original_tmpdir
popd &> /dev/null