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

[docgen] Refactor code to use require() instead of JSON.parse(fs.readFileSync()) #38148

Merged
merged 1 commit into from
Jan 21, 2022

Commits on Jan 21, 2022

  1. [docgen] Refactor code to use require() instead of JSON.parse(fs.read…

    …FileSync())
    
    While working through #37929 I noticed that the tests in the `docgen` package
    read fixture data manually by chaining `JSON.parse()` and `fs.readFileSync()`,
    often at times separated by a number of lines.
    
    In this patch we're replacing those with the more natural `require()` statement
    which removes noise from the test modules and hopefully will also remove a point
    of confusion for those coming in to modify it. We shouldn't have to ask, "why is
    this code doing something that looks normal but is doing it in a notably different
    manner?"
    
    After reviewing the history of the work, initially introduced in #13329, I could
    find no explanation for the approach and found no discussion about it in the PR.
    dmsnell committed Jan 21, 2022
    Configuration menu
    Copy the full SHA
    695cb91 View commit details
    Browse the repository at this point in the history