DEV Community

Discussion on: Can You Refactor JavaScript Safely Without Test Coverage?

Collapse
 
hjames profile image
Harry J Beckwith

Nice article. I have recently discovered writing functional JavaScript combined with unit tests has proven a game changer in terms of reduced bugs and confidence in re use of functions.

When you say automated testing, what do you mean?

Collapse
 
lgrammel profile image
Lars Grammel

Any level of automated test that would improve your confidence that you code is still correct and behaves as expected after the refactoring. This can include unit tests, but also higher level tests like integration or acceptance, and even performance and fault injection testing.

Collapse
 
hjames profile image
Harry J Beckwith

Great thanks. Automated meaning somewhere along the CI/CD to run the tests.

Thread Thread
 
lgrammel profile image
Lars Grammel

Yes, ideally pre-merge. It could also be on your machine. Usually different levels of testing are run at different stages due to their cost / runtime.