I know depression usually has a grave cause and astronauts have quite an active schedule. But say their family dies. Depression makes you think and perceive time differently. Surely wouldn’t it become a risk to the mission? You can’t steamroll over it…
This isn’t a direct answer to your question per se, but if this a topic that interests you, I can’t recommend The Right Stuff enough. I’ve not seen the film from the 80s, though by all accounts it’s pretty good, but the book is an excellent overview of the early days of space exploration, when the exact sort of questions that you ask here were being bandied about by the fledgling, pre-Apollo program NASA.
The focus of the book is on the first wave of astronauts who, as someone else mentioned, were pulled primarily from combat aviation backgrounds. I recall several passages which detailed their reactions to the sorts of psychological testing that they were undergoing, usually complete with humorous anecdotes.