Voir le bout du tunnel (“to see the light at the end of the tunnel”) appeared at the beginning of the 20th century. In the 19th century, people used to say sortir du tunnel, “to go out of the tunnel”. The expression is linked to the development of the railroads, and, in particular, to the tunnels completed to traverse the mountains. It was such a hard work to finish them that voir le bout du tunnel appeared to refer to the end of challenging times. Now you can say Ouf! Je vois le bout du tunnel when you are getting out of some difficulty!