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

Feature: Allow Json Config files + Allow mapping port number #40

Open
falahati opened this issue Jan 27, 2022 · 0 comments
Open

Feature: Allow Json Config files + Allow mapping port number #40

falahati opened this issue Jan 27, 2022 · 0 comments

Comments

@falahati
Copy link

falahati commented Jan 27, 2022

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:

  1. 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.

  2. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant