DEV Community

Cover image for One of the most difficult lab..
jsong89
jsong89

Posted on

One of the most difficult lab..

Github Repo: Project
Commit log: Commit-log

Start..

This lab 8 was to implement tests to apply to the static-site generator in progress in class. In fact, I've heard of this part before, so I chose JEST, a test framework I've heard of before. The framework can test only the part you want, and you can also try running it for each internal test code (npm run is not required!!!).

Processing

Below is what I did to use JEST.
First, I downloaded jest using npm.

npm i -D jest
Enter fullscreen mode Exit fullscreen mode

After the download is complete, I put the following test run command in the package.json file.

"test": "jest",
"test:cover": "jest --coverage",
Enter fullscreen mode Exit fullscreen mode

Lastly, for the files that need testing, I created a test folder and created a test code in ~.test.js under it.

Howevver..

It was easy up to this point, but the problem was that the linkage of each code of my static site generator was too high ( ex:) Even if I wanted to test only A, it was impossible to test only A because B and C were connected.) I've spent a lot of time trying to. But, unfortunately, it was a problem that could not be solved within a limited time because the part had to be repaired from the bottom up...

There are many problems, but one of them is this.
Image description

As a result, I decided stop working for this until now. But, I will update and fixing step by step later :)
It was really competitive and sometimes disappointed for mem but I believe these all things will be an asset for me.

Top comments (0)