-
Notifications
You must be signed in to change notification settings - Fork 132
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
Importing logger from componentParser.js cause parser.test.js to fail #1060
Comments
Occurs for Issue is that Perhaps this issue could be renamed as such Thereafter a new issue could be opened |
What shall i renamed the issue as? Edit: Renamed |
This behavior no longer appears due to the mocking of the entire logger module in #1117, However, it would be more ideal if we use mocked and unmocked instances of |
Yet to un-mock |
The markbind core package resides in /src/lib/markbind/ directory of the markbind-cli package, while the vue components package resides in frontend/components. Let's move these into /packages/ for consistent placing of markbind-cli's dependencies. Let's also rename the packages as scoped packages to reflect the new directory structure. In addition, the core package relied on markbind-cli's logger utilities. This also created some issues with unit tests where the node 'fs' module was mocked (#1060). Let's restructure the logging utilities slightly, giving the core package it's own logger utility, and allowing markbind-cli to override this configuration so that the old behaviour from a user standpoint is preserved.
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
markbind/src/lib/markbind/src/parsers/componentParser.js
Line 7 in 8005582
will cause
parser.test.js
to fail as shown below.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.)
The text was updated successfully, but these errors were encountered: