testcontainers / tc-guide-getting-started-with-testcontainers-for-nodejs

MIT License
6 stars 3 forks source link

Cloning repo and running tests fails #3

Open JackMBurch opened 4 months ago

JackMBurch commented 4 months ago

Just cloning the repo and running tests seems to fail.

Error message:

> tc-guide-getting-started-with-testcontainers-for-nodejs@1.0.0 test
> jest

(node:856308) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
 FAIL  src/customer-repository.test.js
  ● Customer Repository › should create and return multiple customers

      10 |
      11 |     beforeAll(async () => {
    > 12 |         postgresContainer = await new PostgreSqlContainer().start();
         |                             ^
      13 |         postgresClient = new Client({ connectionString: postgresContainer.getConnectionUri() });
      14 |         await postgresClient.connect();
      15 |         await createCustomerTable(postgresClient)

      at getContainerRuntimeClient (node_modules/testcontainers/src/container-runtime/clients/client.ts:60:9)
      at PostgreSqlContainer.start (node_modules/testcontainers/src/generic-container/generic-container.ts:81:20)
      at PostgreSqlContainer.start (node_modules/@testcontainers/postgresql/src/postgresql-container.ts:39:43)
      at Object.<anonymous> (src/customer-repository.test.js:12:29)

  ● Test suite failed to run

    TypeError: Cannot read properties of undefined (reading 'end')

      17 |
      18 |     afterAll(async () => {
    > 19 |         await postgresClient.end();
         |                              ^
      20 |         await postgresContainer.stop();
      21 |     });
      22 |

      at Object.end (src/customer-repository.test.js:19:30)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        0.628 s
Ran all test suites.

Docker version:

Client: Docker Engine - Community
 Version:           25.0.4
 API version:       1.44
 Go version:        go1.21.8
 Git commit:        1a576c5
 Built:             Wed Mar  6 16:32:12 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          25.0.4
  API version:      1.44 (minimum version 1.24)
  Go version:       go1.21.8
  Git commit:       061aa95
  Built:            Wed Mar  6 16:32:12 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.28
  GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Node v21.7.1 Ubuntu 22.04.4 LTS

javierlopezdeancos commented 4 months ago

Hey @JackMBurch thanks to raise the issue,

I run the project clone && install fresh and is passing test for me

Can you try to repeat a fresh cloning install with the Node LTS version 20.11.1 and npm 10.2.4,?

JackMBurch commented 4 months ago

Thank you for the quick response!

Tried and still getting the same thing with Node 20.11.1 and npm 10.2.4.

javierlopezdeancos commented 4 months ago

let me investigate installing a VM with ubuntu on my mac to try it

JackMBurch commented 4 months ago

Much appreciated 🙏

javierlopezdeancos commented 4 months ago

you know what, you are right

Captura de pantalla 2024-03-21 a las 20 36 10

this is my vm running an ubuntu LTS So let me take a look

kiview commented 3 months ago

Are we getting different dependencies pulled on Ubuntu as compared to macOS? Looks like an issue with the Postgres client library to me.