Improves CLI tests and replaces 'tmp' by TEMP_DIR