Fix: codes variable is leaked to global scope.

mocha will return with an error: "global leak detected: codes"