Worse in my experience the quality of documentation (and tests) decreases the more a company is heading for insolvency for multiple overlapping reasons (at least for "startup| like companies).
This means if you want to buy a struggling or insolvent company it will most likely have bad documentation and tests.
But one of the most common steps when buying a struggling company is firing people (making the company fire people before buying it) and the selection of who goes and stays is rarely a good one. And it sets signals which make it mote likely for further important people to quit.
I think the reason to buy a struggling company is simply to get access to its IP (patents mainly) and customers, not to take over its operations. If it's struggling, it was already doing things badly and probably can't be saved.
Usually, when I see tech companies purchased, it's because the company wasn't struggling: it was doing quite well, but was small, so a much larger company bought it up in an acquisition to add its capabilities to their own, like the Borg. The big company gets IP, customers, revenue, and an already-working business, while the founders get a big payout.
This means if you want to buy a struggling or insolvent company it will most likely have bad documentation and tests.
But one of the most common steps when buying a struggling company is firing people (making the company fire people before buying it) and the selection of who goes and stays is rarely a good one. And it sets signals which make it mote likely for further important people to quit.