diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d19184fd9..087602c21 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -381,7 +381,7 @@ jobs: # UNIT TESTS BACKEND ##################################################### ########################################################################## - name: backend | docker-compose - run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mariadb backend + run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mariadb database backend - name: backend Unit tests | test run: docker-compose exec -T backend yarn test ########################################################################## diff --git a/backend/Dockerfile b/backend/Dockerfile index fc853eb63..a65ddaa92 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -73,7 +73,7 @@ RUN yarn run build FROM build as test # Run command -CMD /bin/sh -c "yarn run dev" +CMD /bin/sh -c "yarn run start" ################################################################################## # PRODUCTION (Does contain only "binary"- and static-files to reduce image size) # diff --git a/backend/src/typeorm/connection.ts b/backend/src/typeorm/connection.ts index 0fcd6aac3..857e76d47 100644 --- a/backend/src/typeorm/connection.ts +++ b/backend/src/typeorm/connection.ts @@ -16,7 +16,10 @@ const connection = async (): Promise => { entities: [path.join(__dirname, 'entity', '*.{ts,js}')], synchronize: false, }) - } catch (error) {} + } catch (error) { + // eslint-disable-next-line no-console + console.log(error) + } return con } diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 457faf950..34a2cafd1 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -2,6 +2,20 @@ version: "3.4" services: + ######################################################## + # BACKEND ############################################## + ######################################################## + backend: + image: gradido/backend:test + build: + target: test + networks: + - external-net + - internal-net + environment: + - NODE_ENV="test" + - DB_HOST=mariadb + ######################################################### ## MARIADB ############################################## #########################################################