Outdated project without tests - to upgrade or write test first?


#1

I’m working on an Ember app version 2.12.1, which is moderately large and has no tests.

The goal for this app in the near future is to upgrade it to 3.x and write some tests for the most critical paths (signup, login, CRUD actions, visual comparison).

I’m not sure what is the best path forward, given that both upgrading and setting up / writing the tests will probably be quite time consuming.

Is the best approach to first upgrade to Ember 3.5 and enable working with the latest ember testing framework, or to first try to write some tests in the existing version?

Also, what’s the best way to get an Ember 2.12 app to Ember 3.5? To upgrade incrementally for every minor version, or to do it directly?

Appreciate every advice I can get on this topic, thanks.


#2

Hey @jurgen, I’d say if you have no tests currently you should probably just upgrade first. Normally I’d say write tests first because it’s a great way to verify that your upgrades worked but Ember tests changed a lot in the 2.18-3.0 zone so it seems like a waste of effort to learn “old style” tests, write a bunch of them, and then convert them once you get up to 3.4 (LTS) or 3.5 or whatever. One thing I should note is that you can keep running “old style” tests in 3.x but again it seems like a suboptimal use of your time to go that route provided you are reasonably comfortable with manual testing after your upgrade.

For upgrading my recommendation would be to use ember-cli-update to step through versions one at a time. You could probably do it all in one shot but i find it much more approachable usually to break it into one or two version steps. So first step to 2.13.x where x is the highest patch version, fix any deprecation warnings, etc. You can experiment with when to bump all your 3rd party dependency versions, like you could try that at the beginning to make sure they’re all compatible with 2.12 and then proceed with the core stuff… Also take advantage of the ember-cli-update codemods stuff. Especially when you upgrade to the modules (want to say that was 2.15?) there will be a lot of tedious changes which the codemod could do for you.

And of course if you get stuck let us know here or in discord. Good luck!