Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Can't run test suite #9

Open
JonghunYu opened this issue Mar 5, 2024 · 0 comments
Open

[BUG] Can't run test suite #9

JonghunYu opened this issue Mar 5, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@JonghunYu
Copy link
Contributor

Describe the bug

  • Test has failed with following error messages
  • The database in docker container is running
git:(main) [~/work/coding-challenge-nestjs]yarn test
yarn run v1.22.19
$ jest
[Nest] 24216  - 03/05/2024, 12:39:34 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
Error: connect ECONNREFUSED ::1:5434
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
[Nest] 24215  - 03/05/2024, 12:39:35 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
Error: connect ECONNREFUSED ::1:5434
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
[Nest] 24213  - 03/05/2024, 12:39:35 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
Error: connect ECONNREFUSED ::1:5434
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
[Nest] 24214  - 03/05/2024, 12:39:35 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
Error: connect ECONNREFUSED ::1:5434
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
[Nest] 24211  - 03/05/2024, 12:39:35 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
Error: connect ECONNREFUSED ::1:5434
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
[Nest] 24212  - 03/05/2024, 12:39:36 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
Error: connect ECONNREFUSED ::1:5434
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
[Nest] 24210  - 03/05/2024, 12:39:36 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
Error: connect ECONNREFUSED ::1:5434
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
[Nest] 24216  - 03/05/2024, 12:39:37 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...
Error: connect ECONNREFUSED ::1:5434
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
[Nest] 24215  - 03/05/2024, 12:39:38 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...
Error: connect ECONNREFUSED ::1:5434
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
[Nest] 24213  - 03/05/2024, 12:39:38 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...
Error: connect ECONNREFUSED ::1:5434
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
[Nest] 24214  - 03/05/2024, 12:39:38 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...
Error: connect ECONNREFUSED ::1:5434
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
[Nest] 24211  - 03/05/2024, 12:39:38 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...
Error: connect ECONNREFUSED ::1:5434
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
[Nest] 24212  - 03/05/2024, 12:39:39 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...
Error: connect ECONNREFUSED ::1:5434
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
[Nest] 24210  - 03/05/2024, 12:39:39 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...
Error: connect ECONNREFUSED ::1:5434
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
 FAIL  src/products/products.controller.spec.ts (9.011 s)
  ● ProductsController › should be defined

    thrown: "Exceeded timeout of 5000 ms for a hook.
    Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."

      10 |   let module: TestingModule;
      11 |
    > 12 |   beforeEach(async () => {
         |   ^
      13 |     module = await Test.createTestingModule({
      14 |       imports: [DatabaseModule, TypeOrmModule.forFeature([Product])],
      15 |       controllers: [ProductsController],

      at src/products/products.controller.spec.ts:12:3
      at Object.<anonymous> (src/products/products.controller.spec.ts:8:1)

To Reproduce

  • Run test suite with yarn test command

Expected behavior

  • It should run the test without the error message
@JonghunYu JonghunYu added the bug Something isn't working label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant