Skip to content

Conversation

zorkow
Copy link
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
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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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
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
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).

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