mathjax / MathJax-node

MathJax for Node
Apache License 2.0
615 stars 97 forks source link

test compatibility with ChakraCore #255

Closed pkra closed 7 years ago

pkra commented 8 years ago

Just a note (not a priority for the team at this point.)

ChakraCore now supports OSX and Linux; there's also a node fork using ChakraCore.

Should be a fun thing to test for anyone interested.

pkra commented 7 years ago

I had a few minutes to procrastinate on this.

There are some problems with the browser sniffing code (for example below but there's more beyond that). After hacking the problematic parts and replacing their value with Booleans, at least one test passed (and some output looked ok).

C:\Users\IEUser\Downloads>node node_modules\mathjaxnode\test\issue104.js
TAP version 13
# the SVG width should match the default
Error: TypeError: Unable to get property 'loadTimes' of undefined or null refere
nce
   at Anonymous function (file:///C:/Users/IEUser/Downloads/node_modules/mathjax
/unpacked/MathJax.js:3143:3)
   at Global code (file:///C:/Users/IEUser/Downloads/node_modules/mathjax/unpack
ed/MathJax.js:3111:2)
   at Script.prototype.runInContext (vm.js:35:5)
   at exports.runInContext (vm.js:67:3)
   at processJavaScript (C:\Users\IEUser\Downloads\node_modules\jsdom\lib\jsdom\
living\nodes\HTMLScriptElement-impl.js:128:7)

   at HTMLScriptElementImpl.prototype._eval (C:\Users\IEUser\Downloads\node_modu
les\jsdom\lib\jsdom\living\nodes\HTMLScriptElement-impl.js:65:7)
   at Anonymous function (C:\Users\IEUser\Downloads\node_modules\jsdom\lib\jsdom
\browser\resource-loader.js:31:9)
   at item.check (C:\Users\IEUser\Downloads\node_modules\jsdom\lib\jsdom\living\
nodes\Document-impl.js:88:11)
   at Anonymous function (C:\Users\IEUser\Downloads\node_modules\jsdom\lib\jsdom
\living\nodes\Document-impl.js:107:7)
   at wrappedEnqueued (C:\Users\IEUser\Downloads\node_modules\jsdom\lib\jsdom\br
owser\resource-loader.js:255:7)
not ok 1 plan != count
  ---
    operator: fail
    expected: 1
    actual:   0
  ...

1..1
# tests 1
# pass  0
# fail  1
pkra commented 7 years ago

I should add: npm install mathjax-node@v1.0.0-beta.0 failed so I grabbed mathjax-node manually and installed the dependencies by hand.

dpvc commented 7 years ago

This looks to be the line

    isEdge:      ("MSGestureEvent" in window && "chrome" in window &&
                     window.chrome.loadTimes == null),

Perhaps changing that to

    isEdge:      ("MSGestureEvent" in window && window.chrome != null &&
                     window.chrome.loadTimes == null),

or just commenting out the is* lines of BROWSERS all together would do it.

pkra commented 7 years ago

Yes. After that, some other browser API gave errors so I just set a couple of things to true until it ran :hammer:

pkra commented 7 years ago

Sorry! Just re-read your post and yes, that's basically what I did.

pkra commented 7 years ago

With today's linux nightly build, chakra passes all the tests without the issues mentioned above.

Closing this as fixed upstream.