]> Untitled Git - lemmy.git/blob - scripts/test.sh
make shebangs posix compliant (#2974)
[lemmy.git] / scripts / test.sh
1 #!/usr/bin/env bash
2 set -e
3
4 PACKAGE="$1"
5 echo "$PACKAGE"
6
7 psql -U lemmy -d postgres -c "DROP DATABASE lemmy;"
8 psql -U lemmy -d postgres -c "CREATE DATABASE lemmy;"
9
10 export LEMMY_DATABASE_URL=postgres://lemmy:password@localhost:5432/lemmy
11 # tests are executed in working directory crates/api (or similar),
12 # so to load the config we need to traverse to the repo root
13 export LEMMY_CONFIG_LOCATION=../../config/config.hjson
14 export RUST_BACKTRACE=1
15
16 if [ -n "$PACKAGE" ];
17 then
18   cargo test -p $PACKAGE --all-features --no-fail-fast
19 else
20   cargo test --workspace --no-fail-fast
21 fi
22
23 # Add this to do printlns: -- --nocapture