DEV Community

geekhybrid
geekhybrid

Posted on

Testing Legacy Vue Projects - The right mindset Part 1 of 2

Is the joy of your really fancy component library or project short-lived by the fear that it lacks testing hence it is fragile? Missing out of TDD isn't an eternal curse. You can salvage the situation. Lemme show you how. This is part of a series of three(3) articles, first two articles will prepare you to have the right mindset towards this task. And the final article will feature some real examples.

Alt Text

NO! You don't need to rewrite the project.

"The other developers got it wrong". I will destroy this temple and build it up in 3-days.

The first thought that comes to the minds of noobs is the plan to begin a total rewrite of legacy projects. This consideration may be trivial for small projects, however, for large projects the mere thought of this marks the end to the adoption of testing.

Imagine your legacy project in terms of modules and components.

You might be very fortunate if your existing project is modular or is broken down into small components. But don't worry if it isn't, cos you probably just got your second shot at TDD. Your future components will be test compliant.

Begin 'decomposing' large Vue components into smaller components

Everything matters. Appreciate your little gains. Every step you make towards your ultimate goal of having your code tested counts.

Evaluate your large Vue components, break them into smaller components. DON'T be in a haste to decommission large components or refactor them. Take your time to understand how several pieces communicate with themselves.

In the next piece, I will cover some crucial tips that will help you create better re-usable and tested components.

Let me know your thoughts...

Top comments (0)