I'm planning to ruin a joke someone is going to tell.
Why would you want to ruin their joke?
I saw them joking with my friend and it upset me.
Even if you know the punchline you shouldn't ruin someone's joke. You can tell your own funnier joke if you are jealous of him joking around with your friend.
I'm bitter about it.
Don't you think you might come off looking badly if you ruin his joke? It would be better for you if you figured out a really funny joke to tell yourself.