Usually, doctors shine their flash light in peoples' eyes is to check how your pupils react to light. It is normal that pupils are reactive to light. Even if the light source is only shone in one eye at a time, the two pupils will dialate and constrict equally for most of people. If the pupils will not react to change in light, the person may be has a brain or nerve injury. So, don't be panic if the eye doctors check when they shine their flash light in your eyes.
The doctor is check your pupil through shine flashes light, so they can find out whether there is a problem related to your pupil. And since the light is widening your pupils, they are looking for the speed of dilation because pupils dilation is very important when it comes to our eye health.
When the doctor shines their flash light in your eyes, they are looking at systolic and diastolic function of the pupil. If the pupil's sphincter contracts, miosis could happen, which is dominated by the oculomotor parasympathetic; if the dilator muscle of pupil contracts, mydriasis could happen, which is dominated by sympathetic innervation. Pupil can shrink or expand with the intensity of light. In normal room light, if the pupil diameter is shorter than 1.5 mm or longer than 5 mm with the irregular margins and unresponsive to light, they all belong to morbid.