Skip to content

test(plugins): create the empty running path so the package.json guard is reached - #2990

Merged
bwp91 merged 1 commit into
homebridge:beta-5.28.1from
lidonius1122:fix/test-package-json-guard
Aug 22, 2026
Merged

test(plugins): create the empty running path so the package.json guard is reached#2990
bwp91 merged 1 commit into
homebridge:beta-5.28.1from
lidonius1122:fix/test-package-json-guard

Conversation

@lidonius1122

Copy link
Copy Markdown
Contributor

One of the tests I added in #2973 never reached the check it was named after. leaves the scan alone when the running path has no package.json points runningHomebridgeModulePath at opt-homebridge/empty, which no fixture creates, so realpath() throws ENOENT and it lands in the same branch as the does not exist case below it.

Creating the directory puts it on the branch its name describes. Removing the existsSync(join(resolvedRunningPath, 'package.json')) condition from getInstalledModules() used to leave all 108 tests in the file green; now it fails exactly this one.

No production change, and nothing to clean up: the block's afterEach already removes opt-homebridge and everything under it. 108 passing, lint clean.

…d is reached

The test pointed at a directory no fixture creates, so realpath() threw ENOENT
and it exercised the same branch as the neighbouring "does not exist" case.
Dropping the existsSync check from getInstalledModules left every test in the
file green; with the directory in place it fails exactly this one.
@github-actions github-actions Bot added fix beta Related to Beta Branch labels Aug 22, 2026
@bwp91
bwp91 merged commit 71986da into homebridge:beta-5.28.1 Aug 22, 2026
3 of 5 checks passed
@lidonius1122
lidonius1122 deleted the fix/test-package-json-guard branch August 22, 2026 11:38
bwp91 pushed a commit that referenced this pull request Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beta Related to Beta Branch fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants