Debugging Expression libraries in eclipse (or other editor) using Javascript

I would like to be able to write tests for my expression libraries using and editor and javascript.
I have tried require() and import, but have not been successful

Hi @Tim,

The Snaplogic Expression Language is an in-house-built custom language that is behaviorally mostly like Javascript however, it is not Javascript and can not be used as so in a Javascript editor.

Maybe a unit test/validation pipeline is your best way to achieve this.

Thank you for the response.

I did learn through more research that the engine is the Nashorn engine and due to the fact that it is deprecated in Java 11 there will not be support for it in VScode. Some people have made some progress.

I do have a test pipeline right now. I am finding more discrepancies between Javascript the language spec and Nashorn the implementation. (which is why it is deprecated). That has to be a hard place for you to be in, a new engine could be a backwards compatibility nightmare.

Actually, our Expression Language is not built on top of Nashorn at all. You may have been reading a post about the script snap using a Javascript setting, which is not involved with the expression language.

The Expression Language is a completely custom-built language that actually gets compiled into Java Byte code to be executed on the JCC.

That is good information. I would prefer to write expressions and expression libs than script snaps.

I do wish there was a way to test them from Javascript or Java in a local editor. Something to consider. Probably a lot of work when many of your users may not use a lot of local coding practices?

Yes, that is very valid. I think making the expression builder more IDE like would be very helpful for developing expressions as well as debugging and testing them.

For now, a pipeline that validates expression libraries is the best I can think of.

Thanks for the feedback – if you hadn’t used the Expression Builder before, here’s a preview. It’s definitely not as full featured as a IDE or Text Editor, but has some useful on-the-fly evaluation for writing expressions. As Cole mentioned, there’s still some improvements that we could make, but check it out if you haven’t already.