Yes, your Toyota Tacoma will fail the smog check automatically if the check engine light is on, and a smog check technician is NOT required to refuse inspecting your truck if he/she notices the check engine light is illuminated. They will smog check your Tacoma and it will fail the test.
Have your Tacoma's check engine light diagnosed by a smog check repair station. They will retrieve the trouble codes which are stored in your truck's ECU, which will lead them to repair the fault(s). Once the trouble codes are retrieved, fault(s) repaired and check engine light reset, your Toyota Tacoma will need to be driven approximately 200 miles in order to complete its Emissions Monitors; it will then be ready for a smog check.