Actually, Lupin told Harry, Hermione and Ron about it when they first encountered Sirius in the Shrieking Shack during Prisoner of Azkaban. From Chapter 18:
"Severus was very interested in where I went every month." Lupin told Harry, Ron, and Hermione. "We were in the same year, you know, and we — er — didn't like each other very much. He especially disliked James. Jealous, I think, of James's talent on the Quidditch field... anyway Snape had seen me crossing the grounds with Madam Pomfrey one evening as she led me toward the Whomping Willow to transform. Sirius thought it would be — er — amusing, to tell Snape all he had to do was prod the knot on the tree trunk with a long stick, and he'd be able to get in after me. Well, of course, Snape tried it — if he'd got as far as this house, he'd have met a fully grown werewolf — but your father, who'd heard what Sirius had done, went after Snape and pulled him back, at great risk to his life... Snape glimpsed me, though, at the end of the tunnel. He was forbidden by Dumbledore to tell anybody, but from that time on he knew what I was...."
no subject
"Severus was very interested in where I went every month." Lupin told
Harry, Ron, and Hermione. "We were in the same year, you know, and we —
er — didn't like each other very much. He especially disliked James.
Jealous, I think, of James's talent on the Quidditch field... anyway
Snape had seen me crossing the grounds with Madam Pomfrey one evening as
she led me toward the Whomping Willow to transform. Sirius thought it
would be — er — amusing, to tell Snape all he had to do was prod the
knot on the tree trunk with a long stick, and he'd be able to get in
after me. Well, of course, Snape tried it — if he'd got as far as this
house, he'd have met a fully grown werewolf — but your father, who'd
heard what Sirius had done, went after Snape and pulled him back, at
great risk to his life... Snape glimpsed me, though, at the end of the
tunnel. He was forbidden by Dumbledore to tell anybody, but from that
time on he knew what I was...."