In a heavy-bottomed saucepan, whisk together sugar, cocoa powder, cornstarch and espresso powder until well combined.
Add heavy cream and whole milk and turn on the heat to medium. Whisk constantly until dry ingredients smooth out in the heavy cream and milk and the mixture simmers. Do not boil.
Once the mixture simmers and smooths out, turn off the heat. In a small bowl, whisk together the egg yolks and vanilla extract. Spoon in about ¼ cup of the cream mixture into the egg yolks and vanilla extract and whisk until combined. Repeat three or four more times.
Add the egg yolk mixture to the saucepan with the remaining heavy cream and return to medium heat. Constantly whisk until the mixture thickens and simmers. Do not boil. The mixture won't be as thick as pudding, but it will thicken as it chills.
After the mixture comes to a simmer, turn off the heat and stir in the butter until it melts. Cover the top of the pudding with plastic wrap to prevent a film from forming. Allow to cool and then refrigerate until it sets and chills, about four hours.
To make the parfaits, divide one cup of raspberries among four glasses and top with pudding. Divide the remaining raspberries among the four glasses and top with the rest of the pudding. If desired, top with a dollop of whipped cream and mint leaves.