Skip to content

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented Oct 1, 2025

This PR makes it possible to run MathJax via node in Windows (without needing to use a unix subsystem). The main issue is, as usual, the use of \ rather than / in Windows path names, so we introduce a new function in the context object that converts Windows (absolute) paths to unix-style paths when needed, and use this whenever __dirname or import.meta.url or similar values are used. That way, the management of paths can use / as it currently does.

In addition, the context setup for context.os now handles the situation within node as well (it used to always return undefined). This is done using the process.platform value to make to the generic Unix, Windows, and MacOS values. I wasn't sure how to treat cygwin, but have decided to set it to Windows, since it should not hurt to do the path adjustment there, and my understanding is that cygwin can use Windows paths, so it might be useful to do the translation anyway.

The context tests are adjusted for the new values, and I've added several new files to handle testing Windows and to get full coverage in the tests.

This resolves issue mathjax/MathJax#3439.

@dpvc dpvc requested a review from zorkow October 1, 2025 13:50
@dpvc dpvc added this to the v4.0.1 milestone Oct 1, 2025
Copy link

codecov bot commented Oct 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.72%. Comparing base (afaf1ea) to head (f98da55).

Additional details and impacted files
@@            Coverage Diff             @@
##           develop    #1361     +/-   ##
==========================================
  Coverage    86.72%   86.72%             
==========================================
  Files          337      337             
  Lines        84145    84174     +29     
  Branches      3140     4776   +1636     
==========================================
+ Hits         72971    73000     +29     
  Misses       11174    11174             

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant