Why should the client have to worry about tests or developer documentation? I would not be trying to get it as a line item on the invoice.
Keeping the code base in a state that makes it fast and cheap to add future features is just a professional duty. Decide how to best achieve that on a project by project basis and bake it into your estimates.
Some projects the client just wants the absolute cheapest implementation though and i am completely fine ripping out the need for continual re-factoring or keeping the test suites in good shape IF i've explained the down side to the client first.
So yes, it's my professional duty, but my 'competition' doesn't do it and is therefor cheaper. I don't do much of that work anymore as I now do a lot more own products with my company where I can do it, but if I 'bake it into the estimates' we will come out most expensive. So for us it's line items, and if you, after we explain everything, do not want that, we will remove or not take the contract (depending on the terms).
My latest encounter was an insurer who spend a lot of money on building a system by a hip team who started with node/mongo/react and a few months ago insisted on switching the frontend to Svelte because ‘React is not current tech’ (I am not joking here). No tests, bare minimal docs, bad design (every change takes forever and some changes are deemed impossible) but it works, makes money, client is happy. It took however over 2 years (not cheap guys either; Dutch, 120+euro/hr people) to finish while my beer napkin estimate is 6 months and that would include tests and docs. Easier because there already is a system so that is not fair but the idea that companies are living in some HN nirvana where they pay programmers to implement non business stuff (tests, docs etc) is just not realistic. And the people who do it are not ‘10x’ even then.
If I would say 6 months to rewrite (if that was on the table) inc tests and docs, the client will say; how much without those then?