I researched the placement of Unit Test and E2E Test files in NestJS, so I’ll introduce what I found.
git clone [email protected]:nestjs/nest.git
cd nest
git checkout refs/tags/v7.6.17
After checking NestJS sample code, I decided to adopt the policy of co-locating them under src/.
$ find sample/* -name "*.spec.ts"
sample/01-cats-app/src/cats/cats.controller.spec.ts
sample/19-auth-jwt/src/auth/auth.service.spec.ts
sample/19-auth-jwt/src/app.service.spec.ts
sample/19-auth-jwt/src/app.controller.spec.ts
sample/19-auth-jwt/src/users/users.service.spec.ts
sample/25-dynamic-modules/src/config/config.service.spec.ts
sample/25-dynamic-modules/src/app.controller.spec.ts
sample/26-queues/src/app.controller.spec.ts
sample/27-scheduling/src/app.controller.spec.ts
sample/30-event-emitter/src/app.controller.spec.ts
After checking NestJS sample code, I decided to adopt the policy of placing them under e2e/.
$ find sample/* -name "e2e"
sample/01-cats-app/e2e
sample/19-auth-jwt/e2e
sample/29-file-upload/e2e
That’s all from the Gemba about investigating the placement of Unit Test and E2E Test files in NestJS.