Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor tests to TS. #24357

Merged
merged 1 commit into from
Oct 16, 2024
Merged

Refactor tests to TS. #24357

merged 1 commit into from
Oct 16, 2024

Conversation

Nerivec
Copy link
Collaborator

@Nerivec Nerivec commented Oct 16, 2024

Targeting current 2.0.0 since it builds onto the already cleaned up tests (otherwise would have to refactor again 😛)

@Koenkk Koenkk merged commit 9ea11fa into Koenkk:feat/2.0.0 Oct 16, 2024
11 checks passed
@Nerivec Nerivec deleted the refactor-tests-ts branch October 16, 2024 19:40
Koenkk pushed a commit that referenced this pull request Dec 1, 2024
@djurny
Copy link

djurny commented Jan 6, 2025

Hi @Nerivec @Koenkk,
Someone had an issue with z2m not starting up, which was apparently caused by an empty groups.yaml file being used in configuration.yaml:

#...
groups: groups.yaml # <-- this file does not contain anything
#...

Output:

[21:05:01] INFO: �[32mPreparing to start...�[0m
[21:05:01] INFO: �[32mSocat not enabled�[0m
[21:05:01] INFO: �[32mStarting Zigbee2MQTT...�[0m
Starting Zigbee2MQTT without watchdog.
AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

  (0, node_assert_1.default)(result instanceof Object)

    at read (/app/lib/util/yaml.ts:24:15)
    at Object.readIfExists (/app/lib/util/yaml.ts:36:34)
    at readDevicesOrGroups (/app/lib/util/settings.ts:317:38)
    at read (/app/lib/util/settings.ts:325:5)
    at getPersistedSettings (/app/lib/util/settings.ts:393:21)
    at Object.reRead (/app/lib/util/settings.ts:640:5)
    at start (/app/index.js:130:14)

Is using empty files not supported? Or can the assert(result instanceof Object); in yaml.ts be rewritten to allow empty input?

Groetjes,

@Nerivec
Copy link
Collaborator Author

Nerivec commented Jan 6, 2025

Not sure why this is reported here, but I'd say better to leave the assert, since it would otherwise allow empty configuration.yaml, which would cause other (more common) troubles. Probably need to revisit the splitting logic instead (at least a better error message).

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.

3 participants