0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-07 15:39:42 -05:00

🚧 Add tests option

Signed-off-by: mathieu.brunot <mathieu.brunot@monogramm.io>
This commit is contained in:
mathieu.brunot 2019-06-19 18:31:48 +02:00
parent 2183c37373
commit 0109c3ff1d
No known key found for this signature in database
GPG key ID: 81584BEAF692D7E0
5 changed files with 75 additions and 11 deletions

View file

@ -40,8 +40,7 @@ env:
- NODE_VERSION=10.16.0 COMMAND=clean - NODE_VERSION=10.16.0 COMMAND=clean
- NODE_VERSION=10.16.0 COMMAND=build-devenv - NODE_VERSION=10.16.0 COMMAND=build-devenv
#- NODE_VERSION=10.16.0 COMMAND=run-devenv #- NODE_VERSION=10.16.0 COMMAND=run-devenv
# TODO Add unit test command(s) - NODE_VERSION=10.16.0 COMMAND=test-devenv
#- NODE_VERSION=10.16.0 COMMAND=test
- NODE_VERSION=10.16.0 COMMAND=build-release - NODE_VERSION=10.16.0 COMMAND=build-release
- NODE_VERSION=10.16.0 COMMAND=build-release-frontend - NODE_VERSION=10.16.0 COMMAND=build-release-frontend
- NODE_VERSION=10.16.0 COMMAND=build-release-backend - NODE_VERSION=10.16.0 COMMAND=build-release-backend

View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
echo "Not yet implemented!"
# TODO
#lein test

View file

@ -17,6 +17,8 @@
"dist:assets": "gulp dist", "dist:assets": "gulp dist",
"prod": "gulp dist --production", "prod": "gulp dist --production",
"start": "npm run figwheel", "start": "npm run figwheel",
"build:main": "clojure -Adev tools.clj build main",
"build:view": "clojure -Adev tools.clj build view",
"build:worker": "clojure -Adev tools.clj build worker", "build:worker": "clojure -Adev tools.clj build worker",
"figwheel": "clojure -Adev tools.clj figwheel" "figwheel": "clojure -Adev tools.clj figwheel"
}, },

View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
source ~/.bashrc
npm install
npm run build:main || exit 1;
npm run build:view || exit 1;
npm run build:worker || exit 1;
# TODO
#node ./out/tests.js

View file

@ -49,6 +49,53 @@ function run-devenv {
$CONTAINER $CONTAINER
} }
function test-devenv {
echo "Testing frontend..."
test-devenv-frontend || exit 1;
echo "Testing backend..."
test-devenv-backend || exit 1;
}
function test-devenv-frontend {
# TODO Add frontend unit tests call
echo "Not yet implemented!"
# if ! $(docker images | grep $IMGNAME | grep -q $REV); then
# build-devenv
# fi
#
# CONTAINER=$IMGNAME:latest
#
# echo "Running development image $CONTAINER to test backend..."
# docker run -ti --rm \
# -w /home/uxbox/uxbox/backend \
# -v `pwd`:/home/uxbox/uxbox \
# -v $HOME/.m2:/home/uxbox/.m2 \
# -e UXBOX_API_URL="/api" \
# -e UXBOX_VIEW_URL="/view" \
# $CONTAINER ./scripts/build-tests.sh
}
function test-devenv-backend {
# TODO Add backend unit tests call
echo "Not yet implemented!"
# if ! $(docker images | grep $IMGNAME | grep -q $REV); then
# build-devenv
# fi
#
# CONTAINER=$IMGNAME:latest
#
# echo "Running development image $CONTAINER to test frontend..."
# docker run -ti --rm \
# -w /home/uxbox/uxbox/frontend \
# -v `pwd`:/home/uxbox/uxbox \
# -v $HOME/.m2:/home/uxbox/.m2 \
# -e UXBOX_API_URL="/api" \
# -e UXBOX_VIEW_URL="/view" \
# $CONTAINER ./scripts/build-tests.sh
}
function build-release-frontend-local { function build-release-frontend-local {
if ! $(docker images | grep $IMGNAME | grep -q $REV); then if ! $(docker images | grep $IMGNAME | grep -q $REV); then
build-devenv build-devenv
@ -135,9 +182,9 @@ function usage {
echo "- clean Stop and clean up docker containers" echo "- clean Stop and clean up docker containers"
echo "- build-devenv Build docker container for development with tmux" echo "- build-devenv Build docker container for development with tmux"
echo "- run-devenv Run (and build if necessary) development container (frontend at localhost:3449, backend at localhost:6060)" echo "- run-devenv Run (and build if necessary) development container (frontend at localhost:3449, backend at localhost:6060)"
echo "- test Execute unit tests for both backend and frontend" echo "- test-devenv Execute unit tests for both backend and frontend"
echo "- test-frontend Execute unit tests for frontend only" echo "- test-devenv-frontend Execute unit tests for frontend only"
echo "- test-backend Execute unit tests for backend only" echo "- test-devenv-backend Execute unit tests for backend only"
echo "- build-release Build 'production ready' docker images for both backend and frontend" echo "- build-release Build 'production ready' docker images for both backend and frontend"
echo "- build-release-frontend Build a 'production ready' docker images for frontend only" echo "- build-release-frontend Build a 'production ready' docker images for frontend only"
echo "- build-release-backend Build a 'production ready' docker images for backend only" echo "- build-release-backend Build a 'production ready' docker images for backend only"
@ -155,14 +202,14 @@ case $1 in
run-devenv) run-devenv)
run-devenv run-devenv
;; ;;
test) test-devenv)
test test-devenv
;; ;;
test-frontend) test-devenv-frontend)
test-frontend test-devenv-frontend
;; ;;
test-backend) test-devenv-backend)
test-backend test-devenv-backend
;; ;;
build-release) build-release)
build-release build-release