Updated docker images and tests suites

This commit is contained in:
dbroqua 2020-02-18 13:38:40 +01:00
parent aed75b9576
commit 3ed190bfde
4 changed files with 19 additions and 22 deletions

View file

@ -3,7 +3,8 @@
"username": "postgres",
"password": "postgres",
"database": "test",
"host": "sequelize-middleware-db",
"host": "127.0.0.1",
"port": "5666",
"dialect": "postgres",
"seederStorage": "sequelize"
},

View file

@ -1,33 +1,17 @@
version: "2"
services:
sequelize-middleware:
image: "node:latest"
user: "node"
working_dir: /home/node/app
command: >
bash -c "yarn install &&
./node_modules/.bin/sequelize db:seed:undo:all &&
./node_modules/.bin/sequelize db:migrate:undo:all &&
./node_modules/.bin/sequelize db:migrate &&
./node_modules/.bin/sequelize db:seed:all &&
yarn test --ci --coverage"
volumes:
- ./:/home/node/app
- /home/node/node_modules
ports:
- "3666:4000"
depends_on:
- sequelize-middleware-db
environment:
NODE_ENV: "test"
sequelize-middleware-db:
image: postgres:latest
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
restart: always
ports:
- 127.0.0.1:5666:5432
sequelize-middleware-adminer:
image: adminer
restart: always
ports:
- 127.0.0.1:8666:8080

View file

@ -4,8 +4,15 @@
"description": "Middleware to automate tasks with Sequelize",
"main": "index.js",
"scripts": {
"undo:seed": "./node_modules/.bin/sequelize db:seed:undo:all",
"undo:migrate": "./node_modules/.bin/sequelize db:migrate:undo:all",
"undo:all": "yarn undo:seed && yarn undo:migrate",
"do:migrate": "./node_modules/.bin/sequelize db:migrate",
"do:seed": "./node_modules/.bin/sequelize db:seed:all",
"do:all": "yarn do:migrate && yarn do:seed",
"pretest": "yarn undo:all && yarn do:all",
"lint": "./node_modules/.bin/eslint . --fix",
"test": "jest --forceExit --detectOpenHandles --maxWorkers=10"
"test": "jest --forceExit --detectOpenHandles --maxWorkers=10 --ci --coverage"
},
"repository": {
"type": "git",

5
test.sh Executable file
View file

@ -0,0 +1,5 @@
#! /bin/bash
export NODE_ENV="test";
yarn test