Anything you have ingested, used or otherwise consumed after the 20th week of pregnancy when the baby's intestinal tract had been formed, will show up in bay's meconium.
Every state has different regulation and it may vary from hospital to hospital. It can also depend on your OB/midwife. What they tell you can very much depend on you, if you got regular and early prenatal care, very cooperative and followed all their instructions; if you present yourself as a caring and cared for mother to be, then there may not be any reason for them to test you. However if you or those around you send out warning signals with their presentation, dress or behavior, your health provider can very well test your baby's meconium (poop) without your consent. They can not test you without your express consent and knowledge. Good luck.