Specifically, of course, musical as a genre - the two I’ve seen are on Buffy and Scrubs, where a story excuse is given to run the whole episode as an old fashioned musical, with torch songs, dance numbers, etc. (I kept waiting for the patter song in Buffy, but unfortunately Giles didn’t get to do one.)
So, are there others? Was Buffy the first? (That’s the first one of this specific pastiche kind of format I can think of.) Are they all good? The funny thing to me is that those two examples are both in later seasons that kind of suck, but the musical episodes are awesome - character driven, etc.