Add tests for CommonJS environment variables
Change typeof module from 'function' to 'require' to match Node.js implementation