ljlm0402 / typescript-express-starter

📘 Quick and Easy TypeScript Express Starter
http://npm.im/typescript-express-starter
MIT License
2.73k stars 420 forks source link

[Typegoose] npm run test fail #188

Open ghost opened 2 years ago

ghost commented 2 years ago

Describe the Bug (버그 설명)

On a new generation, running npm run test fails Also noticed that the test command doesnt set the env to "test" so i changed it to "test": "cross-env NODE_ENV=test jest --forceExit --detectOpenHandles",

Version to Reproduce (현재 사용한 버전)

9.2.0

Steps to Reproduce (재현 순서)

Generate new typegoose template, run npm run test

Expected Behavior (예상 동작)

Test passed

Actual Behavior (실제 동작)

 FAIL  src/tests/users.test.ts
  ● Test suite failed to run

    src/tests/users.test.ts:16:60 - error TS2339: Property 'users' does not exist on type 'UserService'.

    16       const users = usersRoute.usersController.userService.users;
                                                                  ~~~~~
    src/tests/users.test.ts:47:60 - error TS2339: Property 'users' does not exist on type 'UserService'.

    47       const users = usersRoute.usersController.userService.users;
                                                                  ~~~~~
    src/tests/users.test.ts:69:60 - error TS2339: Property 'users' does not exist on type 'UserService'.

    69       const users = usersRoute.usersController.userService.users;
                                                                  ~~~~~
    src/tests/users.test.ts:93:60 - error TS2339: Property 'users' does not exist on type 'UserService'.

    93       const users = usersRoute.usersController.userService.users;
                                                                  ~~~~~
    src/tests/users.test.ts:120:60 - error TS2339: Property 'users' does not exist on type 'UserService'.

    120       const users = usersRoute.usersController.userService.users;
Test Suites: 2 failed, 1 passed, 3 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        3.87 s, estimated 4 s
Ran all test suites.
itsmee3223 commented 1 year ago

did you fix it? because i face the same issue when run the test

ghost commented 1 year ago

Sorry I didn't fix it.

itsmee3223 commented 1 year ago

so what you do...?