@iobroker/legacy-testing 4.0.0 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -23,6 +23,12 @@ The variable is ignored if the admin itself is the adapter under test.
23
23
 
24
24
  <!-- ### **WORK IN PROGRESS** -->
25
25
  ## Changelog
26
+ ### 4.0.2 (2026-11-29)
27
+ - (@GermanBluefox) Fixed: `installJsController()` runs `setup first` also after installing js-controller from npm, because js-controller 8 has no install script any more (js-controller#3673); the GUI tests waited forever
28
+
29
+ ### 4.0.1 (2026-10-15)
30
+ - (@GermanBluefox) Fixed `startController(callback)` and `startController(onObjectChange, onStateChange, callback)`: the callback was never called, so the test hung until its timeout (broken since 2.1.0)
31
+
26
32
  ### 4.0.0 (2026-10-03)
27
33
  - (@GermanBluefox) Updated `mocha` to 12.x. The 11.x line pulls in a `serialize-javascript` with a known advisory, and an adapter using this module could not resolve that on its own. Note that `mocha` 12 needs Node.js `^20.19.0 || >=22.12.0`
28
34
  - (@GermanBluefox) Breaking change: minimal Node.js version is now 22.19.0.
package/build/setup.d.ts CHANGED
@@ -43,6 +43,7 @@ declare function startCustomAdapter(customAdapterName?: string, adapterInstance?
43
43
  declare function startController(_isStartAdapter: boolean, _onObjectChange: ChangeHandlerObject, _onStateChange: ChangeHandlerState, _callback?: ControllerCallback): void;
44
44
  declare function startController(_onObjectChange: ChangeHandlerObject, _onStateChange: ChangeHandlerState, _callback?: ControllerCallback): void;
45
45
  declare function startController(_isStartAdapter: boolean, _callback?: ControllerCallback): void;
46
+ declare function startController(_callback?: ControllerCallback): void;
46
47
  declare function stopAdapter(cb?: () => void): Promise<void>;
47
48
  declare function stopCustomAdapter(customAdapterName?: string, adapterInstance?: number): Promise<void>;
48
49
  declare function stopController(cb?: (normalTerminated: boolean) => void): Promise<void>;
package/build/setup.js CHANGED
@@ -421,23 +421,24 @@ async function installJsController(preInstalledAdapters, cb) {
421
421
  stdio: [0, 1, 2],
422
422
  });
423
423
  }
424
+ // js-controller 8 has no install script any more (npm 12 skips them, js-controller#3673), so
425
+ // `setup first` is called here also after a fresh installation. Older versions ran it in their
426
+ // install script already; it runs on every upgrade too, so calling it again does no harm.
427
+ console.log('Setup js-controller...');
428
+ let __pid;
429
+ if (debug) {
430
+ // start controller
431
+ __pid = (0, node_child_process_1.exec)(`node iobroker.js setup first`, {
432
+ cwd: `${rootDir}tmp/node_modules/iobroker.js-controller`,
433
+ });
434
+ }
424
435
  else {
425
- console.log('Setup js-controller...');
426
- let __pid;
427
- if (debug) {
428
- // start controller
429
- __pid = (0, node_child_process_1.exec)(`node iobroker.js setup first`, {
430
- cwd: `${rootDir}tmp/node_modules/iobroker.js-controller`,
431
- });
432
- }
433
- else {
434
- __pid = (0, node_child_process_1.fork)(`iobroker.js`, ['setup', 'first'], {
435
- cwd: `${rootDir}tmp/node_modules/iobroker.js-controller`,
436
- stdio: [0, 1, 2, 'ipc'],
437
- });
438
- }
439
- await waitForEndAsync(__pid);
436
+ __pid = (0, node_child_process_1.fork)(`iobroker.js`, ['setup', 'first'], {
437
+ cwd: `${rootDir}tmp/node_modules/iobroker.js-controller`,
438
+ stdio: [0, 1, 2, 'ipc'],
439
+ });
440
440
  }
441
+ await waitForEndAsync(__pid);
441
442
  // let npm install admin and run setup
442
443
  await checkIsControllerInstalledAsync();
443
444
  let _pid;
@@ -767,28 +768,22 @@ function startController(_isStartAdapter, _onObjectChange, _onStateChange, _call
767
768
  let onObjectChange;
768
769
  let onStateChange;
769
770
  let callback;
770
- let isStartAdapter = typeof _isStartAdapter === 'boolean' ? _isStartAdapter : true;
771
- if (typeof _isStartAdapter === 'function') {
772
- callback = _onStateChange;
773
- _onStateChange = undefined;
774
- onStateChange = _onObjectChange;
775
- _onObjectChange = undefined;
776
- onObjectChange = _isStartAdapter;
777
- isStartAdapter = true;
778
- }
779
- if (_onStateChange === undefined) {
780
- callback = _onObjectChange;
781
- isStartAdapter = _isStartAdapter;
782
- _onObjectChange = undefined;
783
- }
784
- if (typeof _onStateChange === 'function') {
785
- onStateChange = _onStateChange;
786
- }
787
- if (typeof _onObjectChange === 'function') {
788
- onObjectChange = _onObjectChange;
789
- }
790
- if (typeof _callback === 'function') {
791
- callback = _callback;
771
+ let isStartAdapter = true;
772
+ let args = [_isStartAdapter, _onObjectChange, _onStateChange, _callback];
773
+ // The first argument is optional: without it, everything is shifted by one
774
+ if (typeof _isStartAdapter !== 'function') {
775
+ isStartAdapter = _isStartAdapter !== false;
776
+ args = args.slice(1);
777
+ }
778
+ if (args[1] === undefined) {
779
+ // startController([isStartAdapter,] callback)
780
+ callback = args[0];
781
+ }
782
+ else {
783
+ // startController([isStartAdapter,] onObjectChange, onStateChange, callback)
784
+ onObjectChange = args[0];
785
+ onStateChange = args[1];
786
+ callback = args[2];
792
787
  }
793
788
  if (pids.controller) {
794
789
  console.error('Controller is already started!');
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.0.0",
2
+ "version": "4.0.2",
3
3
  "name": "@iobroker/legacy-testing",
4
4
  "main": "build/setup.js",
5
5
  "types": "build/setup.d.ts",