Skip to content

Running Tests on Windows#1370

Merged
zorkow merged 4 commits intomasterfrom
fix/windows-tests
Jan 11, 2026
Merged

Running Tests on Windows#1370
zorkow merged 4 commits intomasterfrom
fix/windows-tests

Conversation

@zorkow
Copy link
Copy Markdown
Member

@zorkow zorkow commented Oct 22, 2025

I've made the tests run under windows, and while most run, there are a couple that fail due to paths. I don't think we should be too worried. The only ones it might be worth looking at are the one regarding Context-node and Require.

@zorkow
Copy link
Copy Markdown
Member Author

zorkow commented Oct 22, 2025

Summary of all failing tests
 FAIL  testsuite/tests/util/asyncLoad/node.test.ts
  ● asyncLoad() for node › asyncLoad()

    expect(received).resolves.toBe()

    Received promise rejected instead of resolved
    Rejected to value: [Error: Cannot find module 'C:\Users\vxs\git\MathJax-src\cjs\components\version.js' from 'C:\Users\vxs\git\MathJax-src\components']

      24 |     await expect(asyncLoad(absUnknown).catch(() => true)).resolves.toBe(true);  // absolute file not found
      25 |
    > 26 |     await expect(asyncLoad('#js/../cjs/components/version.js')                  // load using package exports
         |           ^
      27 |                  .then((result: any) => result.VERSION)).resolves.toBe(mathjax.version);
      28 |     await expect(asyncLoad('@mathjax/src/js/components/version.js')             // load from module
      29 |                  .then((result: any) => result.VERSION)).resolves.toBe(mathjax.version);

      at expect (testsuite/node_modules/.pnpm/expect@29.7.0/node_modules/expect/build/index.js:113:15)
      at testsuite/tests/util/asyncLoad/node.test.ts:26:11
      at fulfilled (testsuite/tests/util/asyncLoad/node.test.ts:4:58)

 FAIL  testsuite/tests/util/asyncLoad/system.test.ts
  ● asyncLoad() for node › asyncLoad()

    expect(received).resolves.toEqual()

    Received promise rejected instead of resolved
    Rejected to value: [Error: Cannot find module 'C:\Users\vxs\git\MathJax-src\mjs\testsuite\lib\AsyncLoad.child.cjs' from 'testsuite/tests/util/asyncLoad/system.cjs']

      19 |     const absUnknown = path.join(root, relUnknown);
      20 |
    > 21 |     await expect(asyncLoad(cjsFile)).resolves.toEqual({loaded: true});          // relative file found
         |           ^
      22 |     await expect(asyncLoad(relUnknown).catch(() => true)).resolves.toBe(true);  // relative file not found
      23 |     await expect(asyncLoad(absFile)).resolves.toEqual({loaded: true});          // absolute file found
      24 |     await expect(asyncLoad(absUnknown).catch(() => true)).resolves.toBe(true);  // absolute file not found

      at expect (testsuite/node_modules/.pnpm/expect@29.7.0/node_modules/expect/build/index.js:113:15)
      at testsuite/tests/util/asyncLoad/system.test.ts:21:11
      at testsuite/tests/util/asyncLoad/system.test.ts:7:71
      at __awaiter (testsuite/tests/util/asyncLoad/system.test.ts:3:12)
      at Object.<anonymous> (testsuite/tests/util/asyncLoad/system.test.ts:14:34)

  ● asyncLoad() for node › setBaseURL() for node

    expect(received).resolves.toEqual()

    Received promise rejected instead of resolved
    Rejected to value: [TypeError: Invalid URL]

      37 |     const relFile = './AsyncLoad.child.cjs';
      38 |     const relUnknown = './AsyncLoad.unknown.cjs';
    > 39 |     await expect(asyncLoad(relFile)).resolves.toEqual({loaded: true});          // relative file found
         |           ^
      40 |     await expect(asyncLoad(relUnknown).catch(() => true)).resolves.toBe(true);  // relative file not found
      41 |   });
      42 |

      at expect (testsuite/node_modules/.pnpm/expect@29.7.0/node_modules/expect/build/index.js:113:15)
      at testsuite/tests/util/asyncLoad/system.test.ts:39:11
      at testsuite/tests/util/asyncLoad/system.test.ts:7:71
      at __awaiter (testsuite/tests/util/asyncLoad/system.test.ts:3:12)
      at Object.<anonymous> (testsuite/tests/util/asyncLoad/system.test.ts:35:44)

 FAIL  testsuite/tests/util/Context-node.test.ts
  ● context object › context

    expect(received).toBe(expected) // Object.is equality

    Expected: "C:\\test.js"
    Received: "C:/test.js"

      22 |       expect(context.path('C:\\test.js')).toBe('C:/test.js');
      23 |     } else {
    > 24 |       expect(context.path('C:\\test.js')).toBe('C:\\test.js');
         |                                           ^
      25 |     }
      26 |     delete context.path;
      27 |     expect(context).toEqual({window: null, document: null, os: OS});

      at Object.<anonymous> (testsuite/tests/util/Context-node.test.ts:24:43)

 FAIL  testsuite/tests/util/asyncLoad/esm.test.ts
  ● asyncLoad() for esm › asyncLoad()

    expect(received).resolves.toEqual()

    Received promise rejected instead of resolved
    Rejected to value: [Error: Cannot find module '/C:/Users/vxs/git/MathJax-src/testsuite/lib/AsyncLoad.child.cjs' from 'mjs/util/asyncLoad/esm.js']

      17 |     const absUnknown = path.join(root, relUnknown);
      18 |
    > 19 |     await expect(asyncLoad(cjsFile)).resolves.toEqual({loaded: true});          // relative file found
         |           ^
      20 |     await expect(asyncLoad(relUnknown).catch(() => true)).resolves.toBe(true);  // relative file not found
      21 |     await expect(asyncLoad(absFile)).resolves.toEqual({loaded: true});          // absolute file found
      22 |     await expect(asyncLoad(absUnknown).catch(() => true)).resolves.toBe(true);  // absolute file not found

      at expect (testsuite/node_modules/.pnpm/expect@29.7.0/node_modules/expect/build/index.js:113:15)
      at testsuite/tests/util/asyncLoad/esm.test.ts:19:11
      at testsuite/tests/util/asyncLoad/esm.test.ts:7:71
      at __awaiter (testsuite/tests/util/asyncLoad/esm.test.ts:3:12)
      at Object.<anonymous> (testsuite/tests/util/asyncLoad/esm.test.ts:12:34)

  ● asyncLoad() for esm › setBaseURL() for esm

    expect(received).resolves.toEqual()

    Received promise rejected instead of resolved
    Rejected to value: [TypeError: Invalid URL]

      35 |     const relFile = './AsyncLoad.child.cjs';
      36 |     const relUnknown = './AsyncLoad.unknown.cjs';
    > 37 |     await expect(asyncLoad(relFile)).resolves.toEqual({loaded: true});          // relative file found
         |           ^
      38 |     await expect(asyncLoad(relUnknown).catch(() => true)).resolves.toBe(true);  // relative file not found
      39 |   });
      40 |

      at expect (testsuite/node_modules/.pnpm/expect@29.7.0/node_modules/expect/build/index.js:113:15)
      at testsuite/tests/util/asyncLoad/esm.test.ts:37:11
      at testsuite/tests/util/asyncLoad/esm.test.ts:7:71
      at __awaiter (testsuite/tests/util/asyncLoad/esm.test.ts:3:12)
      at Object.<anonymous> (testsuite/tests/util/asyncLoad/esm.test.ts:33:43)

 FAIL  testsuite/tests/util/Entities.test.ts
  ● Entities translation › translate()

    expect(received).resolves.toBe()

    Received promise rejected instead of resolved
    Rejected to value: [Error: Cannot find module '/C:/Users/vxs/git/MathJax-src/mjs/util/entities/x.js' from 'mjs/util/asyncLoad/esm.js']

      10 |     expect(Entities.translate('&#x61;')).toBe('a');
      11 |     expect(Entities.translate('&amp;')).toBe('&');
    > 12 |     await expect(handleRetriesFor(() => Entities.translate('&xyz;'))).resolves.toBe('&xyz;');     // no such entity
         |           ^
      13 |     await expect(handleRetriesFor(() => Entities.translate('&approx;'))).resolves.toBe('\u2248'); // load a.js
      14 |     await expect(handleRetriesFor(() => Entities.translate('&Bscr;'))).resolves.toBe('\u212C');   // load scr.js
      15 |     Entities.remove('approx');

      at expect (testsuite/node_modules/.pnpm/expect@29.7.0/node_modules/expect/build/index.js:113:15)
      at testsuite/tests/util/Entities.test.ts:12:11
      at testsuite/tests/util/Entities.test.ts:7:71
      at __awaiter (testsuite/tests/util/Entities.test.ts:3:12)
      at Object.<anonymous> (testsuite/tests/util/Entities.test.ts:8:34)

 FAIL  testsuite/tests/input/tex/Require.test.ts (9.329 s)
  ● Require Options › RequireLoad with prefix

    Expected: "<math xmlns=\"http://www.w3.org/1998/Math/MathML\" data-latex=\"\\requireLoad \\bbox[red]{x}\" display=\"block\">
             <mstyle mathbackground=\"red\" data-latex=\"\\requireLoad \\bbox[red]{x}\">
               <mi data-latex=\"x\">x</mi>
             </mstyle>
           </math>"
    Received: "<math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\">
      <merror data-mjx-error=\"Cannot read properties of undefined (reading 'RequireConfiguration')\" title=\"Cannot read properties of undefined (reading 'RequireConfiguration')\">
        <mtext>Math input error</mtext>
      </merror>
    </math>"

      28 |   // This is slightly awkward way of getting around ts-jest problems with custom
      29 |   // matcher extensions.
    > 30 |   (expect(received) as any).toBeXmlMatch(expected);
         |                             ^
      31 | }
      32 |
      33 | /**

      at toXmlMatch (testsuite/src/xmlMatch.ts:30:29)
      at testsuite/tests/input/tex/Require.test.ts:223:5
      at fulfilled (testsuite/tests/input/tex/Require.test.ts:4:58)


Test Suites: 6 failed, 62 passed, 68 total
Tests:       8 failed, 3159 passed, 3167 total
Snapshots:   0 total
Time:        34.266 s

@dpvc
Copy link
Copy Markdown
Member

dpvc commented Oct 22, 2025

I've identified the problem with these, and have made a new commit to my PR to resolve them. You will ned to merge that into this branch to get them, and will need to rebuild MathJax, as there are changes that affect the lib files in the components, which is what was causing the error in the Require.test.ts file.

@dpvc
Copy link
Copy Markdown
Member

dpvc commented Oct 22, 2025

Oh, and you also need to run pnpm install in the testsuite directory to update the font extension used in one test, otherwise you get a version mismatch warning (which you will not see unless you look at the beginning of the output where the log message is printed).

Base automatically changed from fix/windows-node to develop November 11, 2025 11:55
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 8, 2026

Codecov Report

❌ Patch coverage is 74.23561% with 573 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.54%. Comparing base (d73a2a1) to head (9401d25).
⚠️ Report is 203 commits behind head on master.

Files with missing lines Patch % Lines
ts/ui/dialog/DraggableDialog.ts 64.70% 408 Missing ⚠️
ts/output/common/Wrappers/mo.ts 1.78% 55 Missing ⚠️
ts/output/common/Wrappers/mtable.ts 67.08% 26 Missing ⚠️
ts/output/common.ts 56.00% 11 Missing ⚠️
ts/output/common/Wrappers/mpadded.ts 16.66% 10 Missing ⚠️
ts/adaptors/HTMLAdaptor.ts 52.63% 9 Missing ⚠️
ts/output/chtml/FontData.ts 20.00% 8 Missing ⚠️
components/mjs/startup/hasown.js 30.00% 7 Missing ⚠️
ts/output/common/Wrappers/mrow.ts 30.00% 7 Missing ⚠️
components/mjs/output/util.js 76.00% 6 Missing ⚠️
... and 8 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1370      +/-   ##
==========================================
- Coverage   86.72%   86.54%   -0.19%     
==========================================
  Files         337      340       +3     
  Lines       84174    85993    +1819     
  Branches     3145     4837    +1692     
==========================================
+ Hits        73000    74422    +1422     
- Misses      11174    11548     +374     
- Partials        0       23      +23     

☔ 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.

@zorkow zorkow changed the base branch from develop to fix/windows-path January 8, 2026 19:16
@zorkow zorkow marked this pull request as ready for review January 8, 2026 19:17
@zorkow zorkow requested a review from dpvc January 8, 2026 19:17
Copy link
Copy Markdown
Member

@dpvc dpvc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Base automatically changed from fix/windows-path to master January 10, 2026 19:43
@zorkow zorkow merged commit 27f3759 into master Jan 11, 2026
1 of 3 checks passed
@zorkow zorkow deleted the fix/windows-tests branch January 11, 2026 22:22
@dpvc
Copy link
Copy Markdown
Member

dpvc commented Jan 16, 2026

Unfortunately, this targeted the master branch rather than develop and I didn't catch that. I can revert and retarget develop, but, if I recall correctly, that will make an additional commit on master to undo this one. Alternatively, I could revert the commit to remove it and force-push the master branch one commit back. That is frowned on, but would probably be OK, as the 4.1.1 merge will be coming soon.

How do you want to handle this?

@dpvc dpvc restored the fix/windows-tests branch January 20, 2026 16:16
@dpvc dpvc mentioned this pull request Jan 20, 2026
@dpvc dpvc deleted the fix/windows-tests branch January 20, 2026 16:20
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.

2 participants