Well if it is a secret that someone could get hurt by, like a friend telling you that they're going to commit suicide, or something that could be dangerous, no matter what the person told you not to tell, I think you should tell it. If my friend was going to hurt their self or someone else I would tell someone who could help, like a parent or teacher.
A couple of times I have over heard someone talking to someone else about doing something bad to someone, and I have told that person so they can like watch out for it, or tell a teacher or get help.