Why do we store our test code alongside implementation code?

Question

In this lesson, we’re told that we should now understand

Where and why test code is stored alongside implementation code

This is not explicitly spelled out in the previous lessons. Please expand on this.

Answer

For a typical JavaScript application, we will have a folder/directory containing all the files and data pertinent to the application. With this in mind, storing test code alongside implementation code means storing your test suite for this application someplace in this folder; often in a folder simply called test. This answers the “where” part of the question but what about the “why”? The “why” is primarily to provide convenient access to our test suite so that we’re able to benefit from the positive aspects of testing which we learned about in these lessons.

4 Likes