Bingo for meetings- dockerize tests–part 9

Bingo

Bingo 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)
NrLink
1Create meeting
2Create Tests
3Finalize Create meeting
4Sharing meeting
5Keep Score
6Add obsolete
7Finalizing obsolete
8End meeting
9Dockerize tests
10Azure CI tests
11Yarn workspaces
12CLI
13Intermezzo - CLI improvements
14typescript compile run with node
15NestJS ,swagger and create a meeting
16Finalizing API
17Intermezzo - jest vs jasmine error
18Refactor WebAPI and test service
19Heroku Deploy NestJs
20Angular
21Deploy Angular to GitHub
22WebAPI and Web
23Documentation
24Documentation of the code
25Conclusions

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 ?

  1. Create docker from node
  2. Copy sources ( add a .dockerignore to not copy node_modules)
  3. Install dependencies
  4. Run test
  5. run image  into container and grab the tests results

 

The docker file , named docker_ci_test.txt , has the following content

FROM node:8
WORKDIR /app
COPY . ./
RUN yarn
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.