I have experienced this. Pass out during coughing fit with sever cold. And also I passed out during a spirometry test during a job required physical. But I was told by the doctor he thought I was having TIA, transitory ischemic attacks. Hope that is not true.
This is a common reaction during this test unfortunately. It is probably due to vasovagal response due to the unpleasant experience of arterial blood draw. Vasovagal response is due to your autonomic nervous system reacting to some trigger that creates stress for the individual. They quickly lose their blood pressure and heart rate slows and they pass out. It happens quicker in a sitting or standing position.