Bingo for meetings- dockerize tests–part 9
BingoBingo is a small project, written in TypeScript , and developed with Alexandru Badita in launch break (one hour - more or less). You can find sources at https://github.com/alexandru360/PresentationBingoCards/ . Those are my blog posts for Bingo : ( scroll below for the post)
We have now full DDD and tests that should be run for the objects. However, we need a way to automatically have the tests run . The
easy way is to dockerize the tests – run in a container, grab the results, display somewhere.
First we should have the tests display in a nice form some data. For this, jest have the “reporters” features – but no documentation . So I try to find and https://github.com/dkelosky/jest-stare .
So what are the steps ?
- Create docker from node
- Copy sources ( add a .dockerignore to not copy node_modules)
- Install dependencies
- Run test
- run image into container and grab the tests results
The docker file , named docker_ci_test.txt , has the following content
COPY . ./
RUN yarn test –reporters default jest-stare
CMD tail -f /dev/null
The bat that runs the image and grab results from the container
docker build ../src -f docker_ci_test.txt -t bingo_ci_test
docker run -d –rm –name bingo_ci_test_container bingo_ci_test
docker cp bingo_ci_test_container:/app/jest-stare .
docker container kill bingo_ci_test_container
Feel free to download the project from https://github.com/alexandru360/PresentationBingoCards/ and run the ci_test.bat file from dockerize folder.