First, I would like to assure that the Pennsylvania Department of Health has been very involved in the entire process from seeds or plants entering the state, to growing conditions and cleanliness of facilities, to any potential contamination that may be present.
Second, the state has required the safety labs to complete a very thorough application process demonstrating how they will test to ensure the cannabis is safe for consumption at every step of the process. The labs are not allowed to begin testing until they have received accreditation (this means approval from a very reputable third party company). Additionally, labs are required to complete proficiency tests. This means they receive a sample that has one or several contaminants at known levels by others and they have to find and identify them as well. This reassures everyone that the labs are capable of doing the tests necessary for public safety.
Now, I'm going to go into how we test for yeast and mold. We follow the same testing methods that the FDA uses for food like strawberries. Only the growers have to do extra steps to make sure that unlike strawberries, the cannabis flower won't develop mold after sitting around for two weeks! The growers have to make their flower have a dryness of approximately 10%. Mold likes to grow in humid areas (like a shower). So if you had a cannabis flower you bought in Colorodo and left it in a shower for a couple weeks it would probably develop mold. That is why Colorodo sells flowers in pill bottles so they stay dry.
The growers are required to test the flower to make sure it is safe before they process it. The tests the flower go through include: determining what cannabinoids (THC, CBD and others) are present and their concentrations, what terpenes (pine, lemon, etc) are present and their concentrations, and any contaminant. Contaminant testing includes testing for pesticides, mycotoxins (this is a byproduct of a certain bacteria that is rarely seen in MMJ but is tested for in grain products so the state is being extra cautious), lead, mercury, cadmium, and arsenic, ecoli, salmonella, bipe-tolerant gram negative bacteria (a specific type of bacteria that can cause digestive issues), total bacteria counts, and total yeast and mold counts. The flower must have less than specific amounts set by the Department of Health, the same way produce does.
After passing these tests, the flower is then processed. In this process the cannabinoids and terpenes are separated from the flower so they can either package them directly in a wax form, or add them to a pill or lotion or tincture (a liquid that can be added to food or drink) or a vape cartridge.
Before any process goes to market the state requires the lab to test again for all the same tests the flower went through and making sure no liquids used in extraction remain in the final product. These tests ensure that any packaging used is safe and won't make a patient sick.
Because this process is so involved products have taken a good deal of time to hit shelves at dispensaries. But, by being thorough the state, labs, and growers are ensuring their commitment to patient safety. 
It is necessary to follow the recommended storage instructions that any product comes with. Just as you wouldn't want to eat a cucumber that's been left in a hot car for several weeks, some products recommend cold storage, or shaking before use.
This is a subject I am passionate about and can speak on quite extensively, as evident by the length of this response. If you have additional questions please email and I will respond as time permits. This product has impacted the lives of several people I know, and as a result, if my name is on the testing it's going to be safe for them, because they're why I'm doing this. 



Dr. Kelly Greenland, PhD

How do patients know their MMJ is safe?

Keystone State Testing