Highlighted
Contributor.
Contributor.
126 views

lr.require not returning exported functions

I'm scripting with javascript and trying to make some utility js files that I can load with lr.require.

I've tried various ways, but lr.require seems to always return an empty object.

I've tried  this.

exports.test1 = function(msg) {
  lr.logMessage(msg);
};

and this

exports = {
  test1: function(msg) {
    lr.logMessage(msg);
  }
};

The first give an error saying exports not defined and the second just doesn't work.

Can anyone help with this?

I'm using version 12.60 of VUGEN.

0 Likes
1 Reply
Highlighted
Contributor.
Contributor.

Re: lr.require not returning exported functions

I tried to replicate the "shapes" example here and I still get an error trying to set exports.

https://admhelp.microfocus.com/vugen/en/12.60-12.63/help/function_reference/Content/FuncRef/js_vuser/lrFr_JS_lr_require.htm

It looks something like this.

hapes.js(3): Error: 'ReferenceError: exports is not defined'.
Source line: 'exports.circle = circle;'.

It would be nice to use lr.require, but it seems it's completely broken or maybe I'm missing some key piece of info to get this working.  Any help would be greatly appreciated.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.