Steps

1. Turn on debug mode

If you don’t have debug mode already, turn it on. When debug mode is on, the tester emits verbose logs that can help you better understand what it is doing.

You can enable debug mode by editing the codecrafters.yml file in the root of your repository and pushing a new commit to trigger a build.

Here’s what test output looks like with debug mode turned off (the default):

and here’s what it looks like with debug mode turned on:

2. Try adding logs in your code

Use the infamous printf() debugging technique. Any output on stderr/stdout from your program will be visible in the test logs with the [your_program] prefix.

Adding logs in your code can help narrow down the problem.

3. Ask for help

If you’re still struggling with a bug that is hard to track down, feel free to ask in the forum.

Note: We also have an article specific to the Redis challenge: How do I debug test failures in the Redis Challenge?.