diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index c7f3d7bb..d2b507b6 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -1,18 +1,16 @@ # This workflow will install node dependencies, run tests and report coverage # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs - name: build on: push: branches: - - feat-test-CI-implementation-187419042 - - "*" - develop - + - "*" pull_request: branches: - develop + - "*" jobs: test: @@ -22,6 +20,11 @@ jobs: DB_TEST_URL: ${{ secrets.DB_TEST_URL }} DEV_MODE: ${{ secrets.DEV_MODE }} DB_HOSTED_MODE: ${{ secrets.DB_HOSTED_MODE }} + ACCESS_TOKEN_SECRET: ${{ secrets.ACCESS_TOKEN_SECRET }} + SESSION_SECRET: ${{ secrets.SESSION_SECRET }} + JWT_SECRET: ${{ secrets.JWT_SECRET }} + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} strategy: matrix: @@ -37,15 +40,29 @@ jobs: - name: Install dependencies run: npm install + - name: Run tests + run: npm run test + - name: Run tests and build test coverage run: npm run test:ci - - name: Test & publish code climate coverage - uses: paambaati/codeclimate-action@v5.0.0 - env: - CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - with: - coverageCommand: npm run test:ci - debug: true - coverageLocations: | - ${{github.workspace}}/*.lcov:lcov + - name: Setup Code Climate test-reporter + run: | + # Download test reporter as a static binary + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + chmod +x ./cc-test-reporter + ./cc-test-reporter before-build + - name: Run tests + run: npm run test + + - name: Store coverage report + if: always() + run: mkdir -p coverage + + + - name: Send coverage report to Code Climate + if: always() + run: ./cc-test-reporter after-build -t lcov -p coverage + + - name: coveralls + run: npx coveralls < coverage/lcov.info \ No newline at end of file diff --git a/src/controllers/userController.ts b/src/controllers/userController.ts index 42da40b0..6889e0ce 100644 --- a/src/controllers/userController.ts +++ b/src/controllers/userController.ts @@ -35,7 +35,7 @@ const registerUser = async ( } catch (error) { res .status(500) - .json(new HttpException("SERVER FAIL", "Something went wrong!")); + .json(new HttpException("SERVER FAILS", "Something went wrong!")); } };