Getting acquainted with a legacy codebase

Over the last few days I’ve been getting to grips with a codebase that has been neglected. The original product team have disappeared, the product has had sporadic updates over the years meaning tests have gone awry and product knowledge is held by no one.

For the last six months, a lone developer has spent 2 days a week stabilising the codebase, slowly fixing tests, meeting users and delivering the occasional requirement.

Now it’s my turn to get under the bonnet.

The first thing I’ve spent time on is optimising the Dockerfile to leverage the build cache. The CI build was taking about 7 to 8 minutes, although a good proportion of this was pushing the image (1.4GB) to the registry. Spending time on the Dockerfile has re-acquainted with Docker and given me a greater understanding of how the codebase is put together.

The next thing to do is get the end to end tests working in CI. Protractor wrapped Selenium Web Driver, which is configured to run the tests locally in PhantomJS. For some reason, these tests don’t work, so I’ve simplified the Protractor configuration file and set it to run Puppeteer in headless mode. This works fine on my local machine but it’s going to take more effort to get Puppeteer, which is a wrapper around Chromium, to work in a Docker container. Chromium depends on a bunch of packages being installed, but I don’t want to add to the already bloated Docker image if I can help it.

I’ll write back once I figured this out.