Sounds like your IAC valve. I think your emission testing was just a coincidence unless they pulled a vacuum hose. I assume you have already checked for any unplugged hoses, etc. And the usual have you changed your fuel filter in the last two years, water in the gas (use HEET), air filter clogged.