]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/run-frontend-unittests.sh
import ceph 14.2.5
[ceph.git] / ceph / src / pybind / mgr / dashboard / run-frontend-unittests.sh
CommitLineData
11fdf7f2
TL
1#!/usr/bin/env bash
2
3failed=false
4: ${CEPH_ROOT:=$PWD/../../../../}
5cd $CEPH_ROOT/src/pybind/mgr/dashboard/frontend
6if [ `uname` != "FreeBSD" ]; then
7 . $CEPH_ROOT/build/src/pybind/mgr/dashboard/node-env/bin/activate
8fi
9
10# Build
11npm run build -- --prod --progress=false || failed=true
12
13# Unit Tests
14config='src/unit-test-configuration.ts'
15if [ -e $config ]; then
16 mv $config ${config}_old
17fi
18cp ${config}.sample $config
19
20npm run test:ci || failed=true
21
22rm $config
23if [ -e ${config}_old ]; then
24 mv ${config}_old $config
25fi
26
27# Linting
28npm run lint --silent
29if [ $? -gt 0 ]; then
30 failed=true
31 echo -e "\nTry running 'npm run fix' to fix some linting errors. \
32Some errors might need a manual fix."
33fi
34
35# I18N
eafe8130
TL
36npm run i18n:extract
37i18n_lint=`awk '/<source> |<source>$| <\/source>/,/<\/context-group>/ {printf "%-4s ", NR; print}' src/locale/messages.xlf`
11fdf7f2
TL
38if [[ ! -z $i18n_lint ]]; then
39 echo -e "The following source translations in 'messages.xlf' need to be \
40fixed, please check the I18N suggestions in 'HACKING.rst':\n"
41 echo "${i18n_lint}"
42 failed=true
43fi
44
45if [ `uname` != "FreeBSD" ]; then
46 deactivate
47fi
48
49if [ "$failed" = "true" ]; then
50 exit 1
51fi