Skip to content

Commit

Permalink
Initial Jest test setup + GitHub action for running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasGLund99 committed Nov 5, 2024
1 parent d3885ae commit 9425146
Show file tree
Hide file tree
Showing 9 changed files with 2,573 additions and 174 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Run Tests

on:
push:
branches: ['**']

jobs:
test:
runs-on: ubuntu-latest

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

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

- name: Install dependencies
run: npm install

- name: Run Jest tests
run: npm run test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ dist-ssr
*.sln
*.sw?

# Protbuf folder
proto

# Jest coverage
coverage
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@
### Start server

- `npm run dev:all`

### Test

- `npm run test`
- `npm run test:cov` to show coverage
6 changes: 6 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
preset: 'ts-jest',
testEnvironment: 'node',
clearMocks: true,
// setupFilesAfterEnv: ['<rootDir>/singleton.ts'], // if you're using mocking as discussed earlier
}
Loading

0 comments on commit 9425146

Please sign in to comment.