From 5dc9062444aa5d77fd49ccfe4643cb5719bb359e Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 17 Jan 2024 08:09:58 +0100 Subject: [PATCH] refs #5739 refactor: reset.sh and runTest.sh --- README.md | 6 +++--- db/reset.sh | 2 +- db/resetForce.sh | 3 --- docker-compose.test.yml | 4 ++-- package.json | 4 ++-- runTestFront.sh => runTest.sh | 8 ++++++-- runTestBack.sh | 4 ---- 7 files changed, 14 insertions(+), 17 deletions(-) delete mode 100644 db/resetForce.sh rename runTestFront.sh => runTest.sh (63%) delete mode 100644 runTestBack.sh diff --git a/README.md b/README.md index 8e4f865e6..48f4d5078 100644 --- a/README.md +++ b/README.md @@ -51,14 +51,14 @@ $ sh db/reset.sh Manually reset strucutre/fixtures always. ```sh -$ sh db/resetForce.sh +$ sh db/reset.sh --no-cache ``` ## Running the unit tests For client-side unit tests run from project's root. ```sh -$ sh runTestFront.sh +$ sh runTest.sh front # Or with NodeJS $ npm run test:front @@ -66,7 +66,7 @@ $ npm run test:front For server-side unit tests run from project's root. ```sh -$ sh runTestBack.sh +$ sh runTest.sh back # Or with NodeJS $ npm run test:back diff --git a/db/reset.sh b/db/reset.sh index 76dca9cf5..220870abb 100644 --- a/db/reset.sh +++ b/db/reset.sh @@ -1,3 +1,3 @@ docker compose -f docker-compose.local.yml down db -docker compose -f docker-compose.local.yml build db +docker compose -f docker-compose.local.yml build db $1 docker compose -f docker-compose.local.yml up db -d diff --git a/db/resetForce.sh b/db/resetForce.sh deleted file mode 100644 index f150ef546..000000000 --- a/db/resetForce.sh +++ /dev/null @@ -1,3 +0,0 @@ -docker compose -f docker-compose.local.yml down db -docker compose -f docker-compose.local.yml build db --no-cache -docker compose -f docker-compose.local.yml up db -d diff --git a/docker-compose.test.yml b/docker-compose.test.yml index ecc4a2312..596d16c0c 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -14,8 +14,8 @@ services: context: . dockerfile: front/Dockerfile target: test - # depends_on: - # - back + depends_on: + - back back: image: back restart: always diff --git a/package.json b/package.json index 663c8c53d..a1a08a714 100644 --- a/package.json +++ b/package.json @@ -108,9 +108,9 @@ }, "scripts": { "dbtest": "nodemon -q db/tests.js -w db/tests", - "test:back": "sh runTestBack.sh", + "test:back": "sh runTest.sh back", "test:e2e": "node e2e/helpers/tests.js", - "test:front": "sh runTestFront.sh", + "test:front": "sh runTest.sh front", "test:front:ci": "npx jest --ci --maxWorkers=2", "back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back", "lint": "eslint ./ --cache --ignore-pattern .gitignore", diff --git a/runTestFront.sh b/runTest.sh similarity index 63% rename from runTestFront.sh rename to runTest.sh index da374bea3..e59a4d639 100644 --- a/runTestFront.sh +++ b/runTest.sh @@ -1,3 +1,7 @@ -docker-compose -p salix-testing -f docker-compose.test.yml build --force-rm front -docker-compose -p salix-testing -f docker-compose.test.yml run --rm front +docker-compose -p salix-testing -f docker-compose.test.yml build $1 +if [ $1 = "back" ]; then + docker-compose -p salix-testing -f docker-compose.test.yml build db +fi +docker-compose -p salix-testing -f docker-compose.test.yml run --rm $1 docker-compose -p salix-testing -f docker-compose.test.yml rm -s -v -f + diff --git a/runTestBack.sh b/runTestBack.sh deleted file mode 100644 index e729dea8a..000000000 --- a/runTestBack.sh +++ /dev/null @@ -1,4 +0,0 @@ -# docker-compose -p salix-testing -f docker-compose.test.yml build --no-cache --force-rm db -docker-compose -p salix-testing -f docker-compose.test.yml build --force-rm back db -docker-compose -p salix-testing -f docker-compose.test.yml run --rm back -docker-compose -p salix-testing -f docker-compose.test.yml rm -s -v -f