Skip to content

Commit

Permalink
fix(package.json): Added --runInBand to fix slow connection
Browse files Browse the repository at this point in the history
  • Loading branch information
AllStackDev1 committed Aug 6, 2024
1 parent 1ccf096 commit 852f49e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ jobs:
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Display Variables
run:
echo "REDIS_HOST - ${{ env.REDIS_HOST }}, REDIS_PORT - ${{ env.REDIS_PORT }}, REDIS_USER - ${{ env.REDIS_USER }}, REDIS_PASSWORD - ${{ env.REDIS_PASSWORD }}, DB_HOST - ${{ env.DB_HOST }}, DB_PORT - ${{ env.DB_PORT }}, DB_NAME - ${{ env.DB_NAME }}, DB_USERNAME - ${{ env.DB_USERNAME }}, DB_PASSWORD - ${{ env.DB_PASSWORD }}"
- name: Run lint
run: pnpm lint
- name: Run tests
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"db:create": "pnpm run build && NODE_ENV=development npx sequelize-cli db:create",
"db:migrate:up": "pnpm run build && NODE_ENV=development npx sequelize-cli db:migrate",
"db:migrate:undo": "pnpm run build && NODE_ENV=development npx sequelize-cli db:migrate:undo",
"test": "NODE_ENV=test TEST_MODEL=real jest --runInBand",
"test": "NODE_ENV=test TEST_MODEL=real jest --runInBand --detectOpenHandles",
"test:watch": "NODE_ENV=test TEST_MODEL=real jest --runInBand --watch",
"lint": "eslint ./src/**/*"
},
Expand Down
6 changes: 5 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
import { TYPES } from 'di/types';

import { AuthController, UserController } from 'controllers';
import { RedisClient } from 'configs/redis.config';

@injectable()
export class App {
Expand All @@ -40,6 +41,8 @@ export class App {
private rateLimitHandler: RateLimitHandler,
@inject(TYPES.SessionHandler)
private sessionHandler: SessionHandler,
@inject(TYPES.RedisClient)
private redisClient: RedisClient,
) {}

public async initialize() {
Expand All @@ -66,8 +69,9 @@ export class App {
});
}

public stop(callback: (err?: Error) => void) {
public shutdown(callback: (err?: Error) => void) {
sequelize.close();
this.redisClient.close();
this.httpServer?.close(callback);
}

Expand Down
2 changes: 1 addition & 1 deletion src/tests/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Server Start', () => {
});

afterAll((done) => {
app.stop(done);
app.shutdown(done);
done();
});

Expand Down

0 comments on commit 852f49e

Please sign in to comment.