Beim meinem Adapter epson-esc-vp21 schlägt seit einiger Zeit die Tests auf Github an.
Leider kann ich nicht erkennen, was das Problem ist und wie ich es beheben kann.
Die Tests schlagen an, seitdem ich den Pull-Request Bump @iobroker/testing from 3.0.2 to 4.1.0 eingebunden habe.
Lokal funktionieren die Tests. Da der test:unit als Ausgabe hatte, dass er deprecated ist, habe ich ihn entfernt, jetzt schlägt auf Github der test:integration auf die gleiche Art an.
Die Ausgabe des Tests auf Github ist hier zu finden oder hinter dem Spoiler:
npm run test:integration
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
DEBUG: testing:*
> iobroker.epson-esc-vp21@0.1.2 test:integration /home/runner/work/ioBroker.epson-esc-vp21/ioBroker.epson-esc-vp21
> mocha test/integration --exit
/home/runner/work/ioBroker.epson-esc-vp21/ioBroker.epson-esc-vp21/node_modules/@iobroker/testing/build/tests/integration/index.js:65
const dbConnection = new dbConnection_1.DBConnection(appName, testDir, (0, logger_1.createLogger)(options.loglevel ?? "debug"));
^
SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/runner/work/ioBroker.epson-esc-vp21/ioBroker.epson-esc-vp21/node_modules/@iobroker/testing/build/tests/index.js:4:23)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/runner/work/ioBroker.epson-esc-vp21/ioBroker.epson-esc-vp21/node_modules/@iobroker/testing/build/index.js:17:14)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/runner/work/ioBroker.epson-esc-vp21/ioBroker.epson-esc-vp21/test/integration.js:2:19)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at ModuleWrap.<anonymous> (internal/modules/esm/translators.js:195:29)
at ModuleJob.run (internal/modules/esm/module_job.js:145:37)
at async Loader.import (internal/modules/esm/loader.js:182:24)
at async formattedImport (/home/runner/work/ioBroker.epson-esc-vp21/ioBroker.epson-esc-vp21/node_modules/mocha/lib/nodejs/esm-utils.js:7:14)
at async Object.exports.requireOrImport (/home/runner/work/ioBroker.epson-esc-vp21/ioBroker.epson-esc-vp21/node_modules/mocha/lib/nodejs/esm-utils.js:38:28)
at async Object.exports.loadFilesAsync (/home/runner/work/ioBroker.epson-esc-vp21/ioBroker.epson-esc-vp21/node_modules/mocha/lib/nodejs/esm-utils.js:91:20)
at async singleRun (/home/runner/work/ioBroker.epson-esc-vp21/ioBroker.epson-esc-vp21/node_modules/mocha/lib/cli/run-helpers.js:125:3)
at async Object.exports.handler (/home/runner/work/ioBroker.epson-esc-vp21/ioBroker.epson-esc-vp21/node_modules/mocha/lib/cli/run.js:370:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! iobroker.epson-esc-vp21@0.1.2 test:integration: `mocha test/integration --exit`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the iobroker.epson-esc-vp21@0.1.2 test:integration script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2022-10-28T15_37_31_029Z-debug.log
Error: Process completed with exit code 1.
Hat jemand eine Idee, wo hier das Problem liegt? Ich finde leider noch nicht einmal die Datei in der die zwei Fragezeichen sind, die hier als Fehler gefunden werden.
Wie gesagt, bei mir lokal läuft der Test durch. Es gibt zwar zwei Warnungen über den Zugriff auf nicht existierende Objekte, die ich im Moment auch nicht mehr nachvollziehen kann, aber immerhin läuft der Test durch. Die Ausgaben vom lokalen Lauf hinter diesem Spoiler:
$ DEBUG=testing:* npm run test:integration
> iobroker.epson-esc-vp21@0.1.2 test:integration
> mocha test/integration --exit
testing:integration:ControllerSetup Creating ControllerSetup... +0ms
testing:integration:ControllerSetup directories: +1ms
testing:integration:ControllerSetup controller: /tmp/test-iobroker.epson-esc-vp21/node_modules/iobroker.js-controller +1ms
testing:integration:ControllerSetup adapter: /tmp/test-iobroker.epson-esc-vp21/node_modules/iobroker.epson-esc-vp21 +0ms
testing:integration:ControllerSetup data: /tmp/test-iobroker.epson-esc-vp21/iobroker-data +0ms
testing:integration:ControllerSetup appName: iobroker +1ms
testing:integration:ControllerSetup adapterName: epson-esc-vp21 +0ms
Running tests in /tmp/test-iobroker.epson-esc-vp21
Adapter integration tests
testing:integration:ControllerSetup Testing if JS-Controller is running... +21ms
testing:integration:ControllerSetup => false +2ms
testing:integration:AdapterSetup Creating AdapterSetup... +0ms
testing:integration:AdapterSetup directories: +0ms
testing:integration:AdapterSetup controller: /tmp/test-iobroker.epson-esc-vp21/node_modules/iobroker.js-controller +0ms
testing:integration:AdapterSetup adapter: /tmp/test-iobroker.epson-esc-vp21/node_modules/iobroker.epson-esc-vp21 +1ms
testing:integration:AdapterSetup appName: iobroker +0ms
testing:integration:AdapterSetup adapterName: epson-esc-vp21 +0ms
testing:integration:ControllerSetup Preparing the test directory. JS-Controller version: "dev"... +3ms
testing:integration:ControllerSetup Testing if JS-Controller is installed... +2ms
testing:integration:ControllerSetup => true +1ms
testing:integration:ControllerSetup (Re-)installing JS Controller... +0ms
npm WARN config production Use `--omit=dev` instead.
testing:integration:ControllerSetup => false +997msaning log files
up to date, audited 312 packages in 4s
18 packages are looking for funding
run `npm fund` for details
4 vulnerabilities (3 moderate, 1 high)
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
testing:integration:ControllerSetup Initializing JS-Controller installation... +3s
testing:integration:ControllerSetup => done! +13s
testing:integration:ControllerSetup => done! +0ms
testing:integration:AdapterSetup Copying adapter files to test directory... +17s
testing:integration:AdapterSetup Saving the adapter in package.json +374ms
testing:integration:AdapterSetup Deleting old remains of this adapter +2ms
testing:integration:AdapterSetup Installing adapter +4ms
npm WARN config production Use `--omit=dev` instead.
added 1 package, and audited 312 packages in 1s
18 packages are looking for funding
run `npm fund` for details
4 vulnerabilities (3 moderate, 1 high)
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
testing:integration:AdapterSetup => done! +2s
testing:integration:DBConnection starting DB instances... +0ms
testing:integration:DBConnection creating objects DB +0ms
testing:integration:DBConnection => objects DB type: jsonl +1ms
testing:integration:DBConnection => objects DB lib found at /tmp/test-iobroker.epson-esc-vp21/node_modules/@iobroker/db-objects-jsonl/build/index.js +0ms
Server Data File: /tmp/test-iobroker.epson-esc-vp21/iobroker-data/objects.jsonl
Server Redis inMem-objects listening on port 9001
Redis Objects: Use Redis connection: 127.0.0.1:19001
Objects client ready ... initialize now
Objects client initialize lua scripts
Objects connected to redis: 127.0.0.1:19001
Redis Objects: Use Redis connection: 127.0.0.1:19001
Objects client ready ... initialize now
Objects create System PubSub Client
Objects client initialize lua scripts
Objects connected to redis: 127.0.0.1:19001
testing:integration:DBConnection => done! +276ms
testing:integration:DBConnection creating states DB +0ms
testing:integration:DBConnection => states DB type: jsonl +1ms
testing:integration:DBConnection => states DB lib found at /tmp/test-iobroker.epson-esc-vp21/node_modules/@iobroker/db-states-jsonl/build/index.js +0ms
Server Data File: /tmp/test-iobroker.epson-esc-vp21/iobroker-data/states.jsonl
Server Redis inMem-states listening on port 9000
Redis States: Use Redis connection: 127.0.0.1:19000
States connected to redis: 127.0.0.1:19000
Redis States: Use Redis connection: 127.0.0.1:19000
States create System PubSub Client
States connected to redis: 127.0.0.1:19000
testing:integration:DBConnection => done! +30ms
testing:integration:DBConnection DB instances started +0ms
testing:integration:ControllerSetup Moving databases to different ports... +2s
testing:integration:ControllerSetup => done! +0ms
testing:integration:ControllerSetup Disabling admin instances... +1ms
testing:integration:ControllerSetup => done! +2ms
testing:integration:AdapterSetup Removing old adapter instances... +313ms
testing:integration:AdapterSetup => done! +78ms
testing:integration:AdapterSetup Adding adapter instance... +0ms
Delete file epson-esc-vp21.admin/custom_m.html
Delete file epson-esc-vp21.admin/epson-esc-vp21.png
Delete file epson-esc-vp21.admin/i18n/de/translations.json
Delete file epson-esc-vp21.admin/i18n/en/translations.json
Delete file epson-esc-vp21.admin/i18n/es/translations.json
Delete file epson-esc-vp21.admin/i18n/fr/translations.json
Delete file epson-esc-vp21.admin/i18n/it/translations.json
Delete file epson-esc-vp21.admin/i18n/nl/translations.json
Delete file epson-esc-vp21.admin/i18n/pl/translations.json
Delete file epson-esc-vp21.admin/i18n/pt/translations.json
Delete file epson-esc-vp21.admin/i18n/ru/translations.json
Delete file epson-esc-vp21.admin/i18n/zh-cn/translations.json
Delete file epson-esc-vp21.admin/index_m.html
Delete file epson-esc-vp21.admin/jsonConfig.json
Delete file epson-esc-vp21.admin/style.css
Delete file epson-esc-vp21.admin/words.js
testing:integration:AdapterSetup => done! +2s
testing:integration:DBConnection Stopping DB instances... +2s
testing:integration:DBConnection DB instances stopped +378ms
testing:integration:DBConnection Creating DB backup... +2ms
testing:integration:DBConnection No DB instance is running, nothing to stop... +1ms
Adapter startup
testing:integration:ControllerSetup Cleaning SQLite directory... +2s
testing:integration:ControllerSetup Cleaning log directory... +1ms
testing:integration:DBConnection Restoring DB backup... +6ms
testing:integration:DBConnection No DB instance is running, nothing to stop... +0ms
testing:integration:DBConnection starting DB instances... +2ms
testing:integration:DBConnection creating objects DB +0ms
testing:integration:DBConnection => objects DB type: jsonl +1ms
testing:integration:DBConnection => objects DB lib found at /tmp/test-iobroker.epson-esc-vp21/node_modules/@iobroker/db-objects-jsonl/build/index.js +0ms
Server Data File: /tmp/test-iobroker.epson-esc-vp21/iobroker-data/objects.jsonl
Server Redis inMem-objects listening on port 9001
Redis Objects: Use Redis connection: 127.0.0.1:19001
Objects client ready ... initialize now
Objects client initialize lua scripts
Objects connected to redis: 127.0.0.1:19001
Redis Objects: Use Redis connection: 127.0.0.1:19001
Objects client ready ... initialize now
Objects create System PubSub Client
Objects client initialize lua scripts
Objects connected to redis: 127.0.0.1:19001
testing:integration:DBConnection => done! +31ms
testing:integration:DBConnection creating states DB +0ms
testing:integration:DBConnection => states DB type: jsonl +1ms
testing:integration:DBConnection => states DB lib found at /tmp/test-iobroker.epson-esc-vp21/node_modules/@iobroker/db-states-jsonl/build/index.js +0ms
Server Data File: /tmp/test-iobroker.epson-esc-vp21/iobroker-data/states.jsonl
Server Redis inMem-states listening on port 9000
Redis States: Use Redis connection: 127.0.0.1:19000
States connected to redis: 127.0.0.1:19000
Redis States: Use Redis connection: 127.0.0.1:19000
States create System PubSub Client
States connected to redis: 127.0.0.1:19000
testing:integration:DBConnection => done! +8ms
testing:integration:DBConnection DB instances started +0ms
testing:integration:TestHarness Creating instance +0ms
testing:integration:TestHarness directories: +1ms
testing:integration:TestHarness controller: /tmp/test-iobroker.epson-esc-vp21/node_modules/iobroker.js-controller +0ms
testing:integration:TestHarness adapter: /tmp/test-iobroker.epson-esc-vp21/node_modules/iobroker.epson-esc-vp21 +0ms
testing:integration:TestHarness appName: iobroker +0ms
testing:integration:TestHarness adapterName: epson-esc-vp21 +0ms
testing:unit:adapterTools locating adapter main file in /tmp/test-iobroker.epson-esc-vp21/node_modules/iobroker.epson-esc-vp21... +0ms
testing:unit:adapterTools => trying /tmp/test-iobroker.epson-esc-vp21/node_modules/iobroker.epson-esc-vp21/main.js +0ms
testing:unit:adapterTools => found main.js +1ms
2022-10-29 23:04:22.369 - info: epson-esc-vp21.0 (9058) starting. Version 0.1.2 in /tmp/test-iobroker.epson-esc-vp21/node_modules/iobroker.epson-esc-vp21, node: v16.15.1, js-controller: 4.1.0-alpha.0-20221025-8243bedf
2022-10-29 23:04:22.377 - info: epson-esc-vp21.0 (9058) config device_type: generic
2022-10-29 23:04:22.459 - info: epson-esc-vp21.0 (9058) TCP connection established with the server.
2022-10-29 23:04:22.481 - warn: epson-esc-vp21.0 (9058) State "epson-esc-vp21.0.projector.Lamp hours" has no existing object, this might lead to an error in future versions
2022-10-29 23:04:22.485 - warn: epson-esc-vp21.0 (9058) State "epson-esc-vp21.0.projector.Serial number" has no existing object, this might lead to an error in future versions
The adapter started successfully.
✔ The adapter starts (5400ms)
testing:integration:TestHarness Stopping adapter instance... +5s
testing:integration:TestHarness => giving it 5000ms to terminate +1ms
2022-10-29 23:04:27.390 - info: epson-esc-vp21.0 (9058) Got terminate signal TERMINATE_YOURSELF
2022-10-29 23:04:27.390 - info: epson-esc-vp21.0 (9058) terminating
2022-10-29 23:04:27.391 - info: epson-esc-vp21.0 (9058) Terminated (ADAPTER_REQUESTED_TERMINATION): Without reason
2022-10-29 23:04:27.394 - info: epson-esc-vp21.0 (9058) Got client on "end": undefined, undefined, undefined, undefined
2022-10-29 23:04:27.395 - info: epson-esc-vp21.0 (9058) Got client on "close": false, undefined, undefined, undefined
2022-10-29 23:04:27.893 - info: epson-esc-vp21.0 (9058) terminating
testing:integration:TestHarness Adapter process terminated: +531ms
testing:integration:TestHarness Code: 11 +0ms
testing:integration:TestHarness Signal: null +0ms
testing:integration:TestHarness Adapter terminated +0ms
testing:integration:DBConnection Stopping DB instances... +6s
testing:integration:DBConnection DB instances stopped +326ms
1 passing (28s)
Edit: Die Warnungen waren wohl übrig geblieben, da die Objektdatenbank in /tmp/test-iobroker.epson-esc-vp21 immer wieder verwendet wurden. Mit Löschen dieses Verzeichnises sind die Warnungen auch verschwunden
Nun gut, ich habe die entsprechende Zeile gefunden. Leider bringt mich das auch nicht weiter, denn ich sehe an der Stelle den Fehler nicht. Der "??"-Operator ist doch valide, oder? Warum gibt er mir an der Stelle die Fehlermeldung: "SyntaxError: Unexpected token '?'"
Die Zeile existiert bei mir lokal auch, führt aber nicht zum Fehler.
Das Verzeichnis node_modules ist in .gitignore.
Möglicherweise wird auf Github also ein anderer Inhalt verwendet.
Wie kann ich den Inhalt von node_modules neu aufsetzen? Ein einfaches Löschen (umbenennen) hilft leider nicht, da dann npm run test:integration sich darüber beschwert, dass mocha nicht mehr vorhanden ist.
Edit: Okay, nach dem Entfernen des Verzeichnis node_modules hilft ein "npm install" um es neu aufzusetzen. Der Fehler ist damit leider weiterhin bei mir nicht reproduzierbar.
Wenn ich den entsprechenden Commit rückgängig mache und @iobroker/testing wieder in Version 3.0.2 verwende, verschwinden die Testfehler.
Ich vermute, ich muss an anderer Stelle noch etwas anpassen, damit die Version 4.1.0 von @iobroker/testing funktioniert.
@AlCalzone : Da Du der Hauptentwickler von testing bist, hast Du vielleicht eine Idee für mich, wo ich in meinem Adapter gucken muss, damit ich auf die aktuelle Version von testing wechseln kann?