From 837526e1059da497f3f6c84a15ee2614d6f12f51 Mon Sep 17 00:00:00 2001 From: zuies Date: Wed, 10 May 2023 18:23:09 +0400 Subject: [PATCH] change:ci.yml and add test:ci to package.json --- .github/workflows/ci.yml | 14 +++++++++++--- package.json | 3 ++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de827f9e..3e122765 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,8 @@ name: tc-discordBot -on: [push, pull_request] +on: + push: + pull_request: jobs: test: @@ -16,7 +18,7 @@ jobs: with: node-version: ${{ matrix.node }} env: - NODE_ENV: ${{ secrets.NODE_ENV }} + NODE_ENV: 'test' DB_HOST: ${{ secrets.DB_HOST }} DB_PORT: ${{ secrets.DB_PORT }} DB_USER: ${{ secrets.DB_USER }} @@ -27,8 +29,14 @@ jobs: DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }} SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_ENV: ${{ secrets.SENTRY_ENV }} + - name: Create mongoDB Docker container + run: sudo docker run -d -p 27017:27017 mongo:latest + - name: Add data to userColl collection + run: mongoimport --collection=userColl --db=appDB --file=userColl.json + - name: Add data to appData Collection + run: mongoimport --collection=appData --db=appDB --file=appData.json - run: npm install - - run: jest --ci --detectOpenHandles + - run: npm run test:ci - run: npm run lint - run: npm run format - run: npm run build diff --git a/package.json b/package.json index c0cee3f8..d61991ce 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "start": "node ./lib/index.js", "copy-files": "copyfiles -u 1 src/**/*.yml lib", "dev": "env-cmd -f ./src/config/local.env nodemon ./src/index.ts", - "test": "env-cmd -f ./src/config/test.env jest --ci --detectOpenHandles", + "test": "env-cmd -f ./src/config/test.env jest --detectOpenHandles", + "test:ci": "jest --ci --detectOpenHandles", "lint": "eslint '**/*.ts'", "lint-fix": "eslint --fix '**/*.ts'", "format": "prettier --write 'src/**/*.ts'"