forked from NicTool/api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·34 lines (28 loc) · 835 Bytes
/
Copy pathtest.sh
File metadata and controls
executable file
·34 lines (28 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
set -eu
# set up test database connection for CI (GitHub Actions)
if [ "${CI:-}" = "true" ]; then
sed -i.bak 's/^user[[:space:]]*=.*/user = "root"/' conf.d/mysql.toml
sed -i.bak 's/^password[[:space:]]*=.*/password = "root"/' conf.d/mysql.toml
fi
NODE="node --no-warnings=ExperimentalWarning"
$NODE test-fixtures.js teardown
$NODE test-fixtures.js setup
cleanup() {
echo "cleaning DB objects"
$NODE test-fixtures.js teardown
}
trap cleanup EXIT 1 2 3 6
if [ $# -ge 1 ]; then
if [ "$1" = "watch" ]; then
$NODE --test --watch
else
$NODE --test --test-reporter=spec "$1"
fi
else
# if [ -n "$GITHUB_WORKFLOW" ]; then
# npm i --no-save node-test-github-reporter
# $NODE --test --test-reporter=node-test-github-reporter
# fi
$NODE --test --test-reporter=spec lib/*.test.js lib/*/test.js routes/*.test.js
fi