Skip to content

Commit

Permalink
test(repo): skip jest global setup for unit tests (#106)
Browse files Browse the repository at this point in the history
Fixes #105
  • Loading branch information
jwulf authored Apr 5, 2024
1 parent 265d5a8 commit 989d634
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Unit Tests

on: [push]

jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "18" # Specify a Node.js version

- name: Install dependencies
run: npm install

- name: Run Unit Tests
run: |
npm run test
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"clean": "rm -rf ./dist && rm -f ./tsconfig.tsbuildinfo",
"compile": "tsc --project tsconfig.json",
"docs": "rm -rf ./docs && typedoc",
"test": "jest --detectOpenHandles --testPathIgnorePatterns integration --testPathIgnorePatterns local-integration --testPathIgnorePatterns disconnection --testPathIgnorePatterns multitenancy --testPathIgnorePatterns __tests__/config",
"test": "CAMUNDA_UNIT_TEST=true jest --detectOpenHandles --testPathIgnorePatterns integration --testPathIgnorePatterns local-integration --testPathIgnorePatterns disconnection --testPathIgnorePatterns multitenancy --testPathIgnorePatterns __tests__/config",
"test:integration": "jest --runInBand --testPathIgnorePatterns disconnection --testPathIgnorePatterns __tests__/config --testPathIgnorePatterns multitenancy --detectOpenHandles --verbose true -u",
"test:multitenancy": "jest --runInBand --testPathIgnorePatterns disconnection --testPathIgnorePatterns admin --testPathIgnorePatterns __tests__/config - --detectOpenHandles --verbose true -u",
"test:local": "jest --runInBand --verbose true --detectOpenHandles local-integration -u",
Expand Down
11 changes: 10 additions & 1 deletion src/__tests__/config/jest.cleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,17 @@ import { BpmnParser, ZeebeGrpcClient } from 'zeebe'
export const cleanUp = async () => {
// Your cleanup process here.
console.log('Removing all cached OAuth tokens...')
const o = new OAuthProvider()
const o = new OAuthProvider({
config: {
CAMUNDA_OAUTH_URL: 'dummy',
ZEEBE_CLIENT_ID: 'dummy',
ZEEBE_CLIENT_SECRET: 'dummy',
},
})
o.flushFileCache()
if (process.env.CAMUNDA_UNIT_TEST == 'true') {
return
}
console.log('Removing any running test process instances...')
const filePath = path.join(__dirname, '..', 'testdata')
const files = fs
Expand Down

0 comments on commit 989d634

Please sign in to comment.