Ensure function context is defined for async tests.