Skip to content

Commit

Permalink
Merge pull request #139 from unb-mds/automatizaTesteBackend
Browse files Browse the repository at this point in the history
build: automacao dos testes do backend
  • Loading branch information
Gxaite authored Sep 2, 2024
2 parents 400cae4 + d47d0fc commit 1814e10
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
44 changes: 43 additions & 1 deletion .github/workflows/jest_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ on:
- developer

jobs:
test_frontend:
frontend-tests:
name: Frontend Tests
runs-on: ubuntu-22.04

steps:
Expand All @@ -19,6 +20,14 @@ jobs:
with:
node-version: '20.12.2'

- name: Cache Node.js modules
uses: actions/cache@v3
with:
path: ./front/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/front/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
working-directory: ./front
run: npm install
Expand All @@ -29,4 +38,37 @@ jobs:

- name: Run tests
working-directory: ./front
run: npm test

backend-tests:
name: Backend Tests
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20.12.2'

- name: Cache Node.js modules
uses: actions/cache@v3
with:
path: ./backend/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/backend/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
working-directory: ./backend
run: npm install

- name: Run Lint
working-directory: ./backend
run: npm run lint

- name: Run tests
working-directory: ./backend
run: npm test
6 changes: 4 additions & 2 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "jest --passWithNoTests"
"test": "jest --passWithNoTests",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
},
"keywords": [],
"author": "",
Expand All @@ -19,6 +20,7 @@
},
"devDependencies": {
"jest": "^29.7.0",
"supertest": "^7.0.0"
"supertest": "^7.0.0",
"eslint": "^8"
}
}

0 comments on commit 1814e10

Please sign in to comment.