This is a demonstration on how to make a testing framework watch files in a container. The testing framework used in this demo is Mocha.
Upon looking in the dependencies of Mocha, it uses Chokidar package and requires
CHOKIDAR_USEPOLLING
to watch the files. This problem was also faced in other packages.
- Open Docker desktop application or at least start it is able to run a container.
- While waiting for the desktop application, run
npm install
in case you want run the tests locally first. - When Docker is ready to run a container, run
docker compose up -d
. - Check the desktop application to confirm that the container is running and view its output.
- Try to change the results in sample test.
- You should see that the test will re-run in the container.
Some parts of the repository was based from empty_package_json
branch of Web Template.
Coded by Kenneth Trecy Tobias.