Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
June 29, 2022 05:30 pm GMT

RhinoJS runs node.js

A quick tip for the one or two people doing Google searches about RhinoJS, wishing, neh, hoping that thier product can adopt node.js somehow and have a modern scripting environment.

You have some options, it's not amazing but it's hope, you can use runCommand('node pathToFile.js', {opts}) fear not the documentation for this command is actually good! There we go, node.js like the respectful great grandson skateboards around doing the work for grandpa, the stuff that rhino just can't. Like run Babel and pipe the script to Rhino for running.

Once ran be sure to console.log from node, The stdout as captured by RhinoJS can be read as well as the process error count code.

Why

I managed to compile jasmine through Babel then bootstrap it and run it in rhino, I then wanted the tests to all be wrote in a modern way, I wanted rhino to run the test files without another build step

So we have rhino patched to be a little more node like, running modern JavaScript and Jasmine with a little help from Node.js

How about the other way around?

Running Rhino from node, same principle, use child_process

I think that is how I'm going to handle testing, this rhino thing is a bit ass backwards, jest could exec a script in rhino and check the results, there would be some intervention but that's to extrapolate the results.

Anyway both ways need node.js so maybe I need to evaluate my use cases.. at runtime node didn't have to be a dependency I could just make do with


Original Link: https://dev.to/adam_cyclones/rhinojs-runs-nodejs-2763

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To