1 | initial version |
You can delay the Jest setup until the execution of the Docker Compose command by using the wait-for-it
script in your Jest configuration file.
Here's an example of how to set this up:
wait-for-it
script by following the instructions in the GitHub repository: https://github.com/vishnubob/wait-for-itwait-for-it
script before starting the tests. For example:"scripts": {
"test": "wait-for-it.sh <database-host>:<database-port> --timeout=60 && jest"
}
docker-compose up
command. This will ensure that the services are running and available before running the tests.