Skip to content

CLAUDE.md: the two other prerequisites for local integration tests - #576

Merged
GermanBluefox merged 1 commit into
masterfrom
docs/integration-test-prerequisites
Oct 3, 2026
Merged

GermanBluefox merged 1 commit into
masterfrom
docs/integration-test-prerequisites

Conversation

@GermanBluefox

Copy link
Copy Markdown
Contributor

CLAUDE.md said only that no js-controller may be running. Two more conditions are just as binding, and each costs a failed run to discover — it took me three while working on #295, all of them setup rather than code.

The directory name decides the adapter name

test/lib/setup.js derives both names from the path:

let adapterName = path.normalize(rootDir).split('/');
adapterName = adapterName[adapterName.length - 2];   // "ioBroker.sql"
// ...
const id = 'system.adapter.' + adapterName.split('.').pop() + '.0';
checkout in what happens
_wt_295/ npm install _wt_295.js-controller@dev → npm rejects a name starting with _
iobroker.sql-295/ installs fine, then looks up system.adapter.sql-295.0, which does not exist → the before hook dies with Cannot read properties of undefined (reading 'common')
<anything>/ioBroker.sql works

The last one is the useful part: a worktree is fine as long as its leaf directory is ioBroker.sql.

node_modules must not be a junction

copyAdapterToController() copies the whole adapter folder into tmp/node_modules/, and its exclusion list (.idea, test, tmp, .git, src-admin, <app>.js-controller) does not mention node_modules. The recursive copy therefore walks into it, and with a link it leaves a half-copied adapter behind — the failure surfaces later, somewhere else entirely.

npm install in the worktree takes about 20 s. Linking tmp/ from another checkout is fine and saves the js-controller download.

And the port 9000 guard reports success

The existing note now also says that the guard calls process.exit(0). A run it blocks exits 0 having executed nothing, which reads exactly like a green run — that is how it looked to me at first.

Documentation only.

🤖 Generated with Claude Code

The note said only that no js-controller may be running. Two more conditions
are just as binding, and each costs a failed run to discover - three, in the
case I hit while working on #295.

- The checkout directory has to be named `ioBroker.sql`. setup.js derives
  `appName` and `adapterName` from the path and then looks up
  `system.adapter.${adapterName.split('.').pop()}.0`, so a worktree in
  `my-branch/` asks npm for `my-branch.js-controller` and one in
  `iobroker.sql-295/` looks for `system.adapter.sql-295.0` and dies in the
  `before` hook with "Cannot read properties of undefined (reading 'common')".
- `node_modules` must be a real directory, not a junction.
  copyAdapterToController() copies the whole folder into `tmp/node_modules/`
  without excluding `node_modules`, so the recursive copy walks into the link
  and leaves a half-copied adapter.

Also notes that the port 9000 guard exits with `process.exit(0)`, so a run it
blocks reports success - mocha exits 0 having executed nothing, which is easy
to read as a green run.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@GermanBluefox
GermanBluefox merged commit 2797d05 into master Oct 3, 2026
17 checks passed
@GermanBluefox
GermanBluefox deleted the docs/integration-test-prerequisites branch October 3, 2026 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant