Hey, great package,
Spend a few minutes trying to integrate this package replacing custom shell scripts into the project and the following two issues are what apparently stopped me from going forward:
Just like jest-config.ts and jest-config.json, we could really use a json version of jest-testcontainers-config.js file. I suspect it is the easier option in comparison to supporting ts-node and jest-testcontainers-config.ts. In any case, currently, typescript is not happy with having a javascript file as we use allowJS: false in our projects.
Secondly, it would be quite useful to be able to map the exposed port to another different local port. This is especially useful for developers trying to run tests on a clean database for example while they have a development database already deployed as a container. If the development database is on the default port, there is currently no way to run a new separate database on a new port to be able to run tests
edit: it seems that this package does in fact assign a random port, or at least that is what I am getting from the examples posted, so in that case, the second argument here should be defended from another angle, let's say I can not modify the port number while running the tests, in that case, we can really use a forced port number for the test container. for example in our code, we have a config module that does provide configuration for a specific environment and we have a test environment that we use to load when running tests, without a fixed port number we now have to mock this module in e2e tests and provide the right database port which slows writing tests significantly. Another option would be to be able to modify the environment variable name for the port and this would probably also solves a great number of problems since almost every application written allows for changing the config of the app via environment variables, they just probably not going to use the same name for the environment variable as is returned by this package.
Hey, great package, Spend a few minutes trying to integrate this package replacing custom shell scripts into the project and the following two issues are what apparently stopped me from going forward:
Just like
jest-config.ts
andjest-config.json
, we could really use ajson
version ofjest-testcontainers-config.js
file. I suspect it is the easier option in comparison to supportingts-node
andjest-testcontainers-config.ts
. In any case, currently, typescript is not happy with having a javascript file as we useallowJS: false
in our projects.Secondly, it would be quite useful to be able to map the exposed port to another different local port. This is especially useful for developers trying to run tests on a clean database for example while they have a development database already deployed as a container. If the development database is on the default port, there is currently no way to run a new separate database on a new port to be able to run tests
edit: it seems that this package does in fact assign a random port, or at least that is what I am getting from the examples posted, so in that case, the second argument here should be defended from another angle, let's say I can not modify the port number while running the tests, in that case, we can really use a forced port number for the test container. for example in our code, we have a config module that does provide configuration for a specific environment and we have a test environment that we use to load when running tests, without a fixed port number we now have to mock this module in e2e tests and provide the right database port which slows writing tests significantly. Another option would be to be able to modify the environment variable name for the port and this would probably also solves a great number of problems since almost every application written allows for changing the config of the app via environment variables, they just probably not going to use the same name for the environment variable as is returned by this package.