forked from entrepreneur-interet-general/opensignauxfaibles
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test-all.sh
executable file
·102 lines (75 loc) · 2.73 KB
/
test-all.sh
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
# Usage:
# $ git secret reveal # pour déchiffrer les données utilisées par les tests (golden files, etc...)
# $ ./test-all.sh # pour éxecuter tous les tests
# $ ./test-all.sh --update # pour éxecuter tous les tests et mettre à jour les snapshots des tests go + "ava" + les golden files des tests de bout en bout
# $ git secret changes # pour visualiser les modifications éventuellement apportées aux golden files
# $ git secret hide # pour chiffrer les golden files suite à leur modification
function heading {
echo ""
echo "–––––"
echo "$1"
echo "–––––"
}
function indent {
sed 's/^/ /'
}
# Optional tests (cannot stop the script)
heading "pick specified node.js version"
(. ~/.nvm/nvm.sh; cd ./js && nvm use) 2>&1 | indent
# Mandatory tests (can stop the script)
set -e # will stop the script if any command fails with a non-zero exit code
set -o pipefail # ... even for tests which pipe their output to indent
heading "npm install"
(cd ./js && npm install) 2>&1 | indent
heading "typescript check"
(cd ./js && npx tsc --noEmit) 2>&1 | indent
heading "npm test"
if [[ "$*" == *--update* ]]
then
(cd ./js && npm run lint:fix && npm run test:update-all) 2>&1 | indent
else
(cd ./js && npm run lint && npm run test) 2>&1 | indent
fi
heading "go generate"
(rm lib/engine/jsFunctions.go || true; go generate ./...) 2>&1 | indent
heading "make build"
(killall sfdata 2>/dev/null || true; make build && echo "📦 sfdata") 2>&1 | indent
heading "go test"
if [[ "$*" == *--update* ]]
then
(go test ./... -test.count=1 -update) 2>&1 | indent
else
(go test ./... -test.count=1) 2>&1 | indent
fi
heading "test-cli.sh"
./tests/test-cli.sh $@ 2>&1 | indent
heading "test-prune-entities.sh"
./tests/test-prune-entities.sh $@ 2>&1 | indent
heading "test.sh"
./tests/test.sh $@ 2>&1 | indent
heading "test-validate.sh"
./tests/test-validate.sh $@ 2>&1 | indent
heading "test-check.sh"
./tests/test-check.sh $@ 2>&1 | indent
heading "test-import.sh"
./tests/test-import.sh $@ 2>&1 | indent
heading "test-compact.sh"
./tests/test-compact.sh $@ 2>&1 | indent
heading "test-compact-failure.sh"
./tests/test-compact-failure.sh $@ 2>&1 | indent
heading "test-public.sh"
./tests/test-public.sh $@ 2>&1 | indent
heading "test-reduce.sh"
./tests/test-reduce.sh $@ 2>&1 | indent
heading "test-reduce-2.sh"
./tests/test-reduce-2.sh $@ 2>&1 | indent
#heading "test-purge-batch.sh"
#./tests/test-purge-batch.sh $@ 2>&1 | indent
heading "test-export.sh"
./tests/test-export.sh $@ 2>&1 | indent
# Check if the --update flag was passed
if [[ "$*" == *--update* ]]
then
echo "ℹ️ Golden master files were updated => you may have to run: $ git secret hide" # to re-encrypt the golden master files
fi