You've had some excellent advice about a storm. Your question, however, encompasses squalls, fronts, and storms. That's a very big topic. All the answers depend on where the nearest land is, what the wind direction is in relation to the land, and how long the severe weather will last.
If you sail in deep water, then you have to sail, or heave-to (which is still sailing, it's just easier on the helmsman), or run off if you have searoom.
In a short squall, don't overlook just anchoring and riding it out, if your water isn't too deep. I sail on a lake these days, with shallow water, and that would be my choice if I ran out of searoom and couldn't make progress to windward with sail, motor (and yes outboards may cavitate and be less useful), or both. Drop sail, anchor, and ride it out.
This should work on a shallow-sloping shore. It may not work on a steep or rocky shore.
Each situation is unique. Heaving-to may work in deep water if you're exhausted and just have to sleep, and you're making at least minimal forward progress.
But there's no simple answer to what was a pretty broad question. You have to figure out what fits the boat, you, your searoom, your guess as to the weather severity and duration, and hope you figured right.