test: fixed `npm search` tests failing on CI

Fixed `helpers.runNpmInDirectory()` to configure custom npm cache directory.
This ensures that both developers and CI server use the same cache.

Fixed `npm search` tests to clean the npm cache before running the test. This
solves the problem where the test was failing because npm was using a stale
cached search result.

Added more debug logging to help troubleshoot failing tests.

Modified `helpers.runNpmInDirectory()` to pass `enc` to `child_process.exec()`,
now it's no longer necessary to convert `stdout` and `stderr` to string.