Skip to content

issue with log import in database.js #1597

@huss

Description

@huss

Describe the bug

I missed that PR #1559 causes an issue on the requires. All the tests run successfully but at the start of the tests, look at the node tests it shows:

> open-energy-dashboard@1.0.0 test
> NODE_ENV=test mocha --timeout 15000 "src/server/test/**/*.js"

(node:324) Warning: Accessing non-existent property 'log' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)

This is now also seen when you do test or testsome locally as a developer.

To Reproduce

The easiest way is to pick any test file and run it with the testsome command on a development machine.

Expected behavior

Obviously, this should not be happening. I went into src/server/models/database.js and commented out the log require and its one new use in logging and the issue went away. It seems directly due to its new inclusion in this file but also that it is imported again in src/server/test/common.js for each test. The best way to resolve this has not been investigated.

Additional context

None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    p-medium-priorityt-bugThe issue is related to an aspect of the software which is incorrect

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions