I have been searching for repos to contribute during October, but got no luck. The repos I came across either have poor documentation or it is a bit complicated for my current level. Since I have already worked on testing for third PR, I decided to do testing again by adding a frontend test setup to Telescope.
Telescope never had a test module for frontend. And I guess for most of the web apps out there, frontend testing has always been neglected. Part of the reason is because of its constant changing nature that makes it hard to write tests, especially components tests.
The way I approach this was to follow testing setup guide from Gatsby, frontend framework used for Telescope. The setup has added a few new files to the frontend folder and I have learned about what each added file does through the process. It was a very clear guide. The next thing that I did was to modify Gatsby setup to meet Telescope’s naming conventions. Telescope team do not support __dir__ pattern and have suggested me to use the name without the underscores instead. Additionally, I have provided a sample test case for Spinner components to test if my setup worked.
Everything seemed to work as expected until I pushed to Github for reviewing. The first pushed failed CI tests due to linting errors. There was something eslint did not like about my format. I fixed the linting errors, rebased my commit and pushed again. It failed again! This time was due to the hash tests. Apparently, the backend testing module picked up the frontend tests as well and there was some format that was specifically for backend. I should have run npm run test before commiting. Another lesson was learned. I discussed with Josue, one of the maintainers, about this issue and agreed with him to avoid the frontend tests completely in backend test setup and create a separate script for running frontend testing. I did just that by making some changes to package.json and pushed again. This time I ensured I run npm run test before commiting and everything worked as expected. My commits also passed the CI checks on Github as welll.
Through this PR, I have learned valuable lessons in setting up testing environment and always run test locally before commiting.
The journey in software development keeps getting better and better and I look forward to more challenges in OSD600 in the second half of the semester.
Thank you for reading!