Skip to content

Importing logger from componentParser.js cause parser.test.js to fail #1060

@nbriannl

Description

@nbriannl

Is your request related to a problem?

In MarkBind Version: 2.11.0, I have an issue when importing logger from componentParser.js cause parser.test.js to fail.
For example, calling it accordingly as here

const logger = require('../../../../util/logger');

will cause parser.test.js to fail as shown below.
image

As @ang-zeyu has pointed out, this occurs for parser.js as well, which is likely the reason logger isn't used in there as well.

The issue is that parser.test.js mocks the whole fs module, which causes the DailyRotateFile constructor to fail automatically in finding the directory.

Describe the solution you'd like

A simple fix would be to only mock the specific functions of fs relavant to parser.test.js

(Describe your proposed solution here.)

Describe alternatives you've considered

(Write your answer here.)

Additional context

(Write your answer here.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions