From 130237fc87708678920fc5121360e316fb1ed235 Mon Sep 17 00:00:00 2001 From: ankitsridhar16 Date: Tue, 20 Dec 2022 14:41:50 +0530 Subject: [PATCH 1/2] feat: added jest and jest-fp-ts setup --- packages/hoppscotch-backend/global.d.ts | 1 + packages/hoppscotch-backend/jest.setup.js | 1 + packages/hoppscotch-backend/package.json | 9 +++++++-- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 packages/hoppscotch-backend/global.d.ts create mode 100644 packages/hoppscotch-backend/jest.setup.js diff --git a/packages/hoppscotch-backend/global.d.ts b/packages/hoppscotch-backend/global.d.ts new file mode 100644 index 000000000..78769ebc0 --- /dev/null +++ b/packages/hoppscotch-backend/global.d.ts @@ -0,0 +1 @@ +import '@relmify/jest-fp-ts'; diff --git a/packages/hoppscotch-backend/jest.setup.js b/packages/hoppscotch-backend/jest.setup.js new file mode 100644 index 000000000..18ffac71d --- /dev/null +++ b/packages/hoppscotch-backend/jest.setup.js @@ -0,0 +1 @@ +require('@relmify/jest-fp-ts'); diff --git a/packages/hoppscotch-backend/package.json b/packages/hoppscotch-backend/package.json index 6e3a31005..4021ca5dc 100644 --- a/packages/hoppscotch-backend/package.json +++ b/packages/hoppscotch-backend/package.json @@ -29,11 +29,13 @@ "@prisma/client": "^4.7.1", "apollo-server-express": "^3.11.1", "apollo-server-plugin-base": "^3.7.1", + "express": "^4.17.1", "fp-ts": "^2.13.1", "graphql": "^15.5.0", "graphql-query-complexity": "^0.12.0", "graphql-redis-subscriptions": "^2.5.0", "graphql-subscriptions": "^2.0.0", + "io-ts": "^2.2.16", "ioredis": "^5.2.4", "prisma": "^4.7.1", "reflect-metadata": "^0.1.13", @@ -44,8 +46,9 @@ "@nestjs/cli": "^9.1.5", "@nestjs/schematics": "^9.0.3", "@nestjs/testing": "^9.2.1", + "@relmify/jest-fp-ts": "^2.0.2", "@types/express": "^4.17.14", - "@types/jest": "29.2.3", + "@types/jest": "^27.5.2", "@types/node": "^18.11.10", "@types/supertest": "^2.0.12", "@typescript-eslint/eslint-plugin": "^5.45.0", @@ -53,7 +56,8 @@ "eslint": "^8.29.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-prettier": "^4.2.1", - "jest": "29.3.1", + "jest": "^29.3.1", + "jest-mock-extended": "^3.0.1", "prettier": "^2.8.0", "source-map-support": "^0.5.21", "supertest": "^6.3.2", @@ -69,6 +73,7 @@ "json", "ts" ], + "setupFilesAfterEnv": ["@relmify/jest-fp-ts"], "rootDir": "src", "testRegex": ".*\\.spec\\.ts$", "transform": { From 7ebed70316da2c5592b4c59001c42c8013ae003c Mon Sep 17 00:00:00 2001 From: ankitsridhar16 Date: Tue, 20 Dec 2022 14:52:54 +0530 Subject: [PATCH 2/2] fix: fixes nest restart issue --- packages/hoppscotch-backend/docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/hoppscotch-backend/docker-compose.yml b/packages/hoppscotch-backend/docker-compose.yml index 9b22e6f75..1480d8735 100644 --- a/packages/hoppscotch-backend/docker-compose.yml +++ b/packages/hoppscotch-backend/docker-compose.yml @@ -2,6 +2,7 @@ version: '3.0' services: local: build: . + command: ["pnpm", "run", "start:dev"] environment: - PRODUCTION=false - DATABASE_URL=postgresql://postgres:testpass@dev-db:5432/hoppscotch?connect_timeout=300