Description
Description
We have a JS vro project, containing the following action:
(function () {
var Strings = function () {
throw new Error("private constructor");
};
Strings.escapeHtml = function (str) {
return str
.replace(/&/g, "&")
.replace(/\</g, "<")
.replace(/\>/g, ">")
.replace(/'/g, "'")
.replace(/"/g, """);
};
return Strings;
})
When used as a dependency in another JS vro project, in the copied Strings.js file in the target dependencies folder, the escapeHtml method is changed to:
Strings.escapeHtml = function (str) {
return str
.replace(/&/g, "&")
.replace(/\</g, "<")
.replace(/\>/g, ">")
.replace(/'/g, "'")
.replace(/"/g, """);
};
Causing the following error (shortened):
Error in beforeEach: C:\DEV\Github\pscoe.reusable-components.wl.nsx\target\vro-tests\dependencies\...\elements\...\Strings.js:226
[ERROR] .replace(/"/g, """);
[ERROR] ^^
It seems that strings containing HTML-escaped characters are being "unescaped".
Steps to Reproduce
- In a JS project, add the Strings JS action above and build
- In another test JS project, use Strings in a JS action:
var Strings = System.getModule("first.test.project").Strings();
...
var escapedString= Strings.escapeHtml("sometString");
- Create a unit test for the action, placing the setup (fetching the action) in a try/catch block, outputting the stack of the error to the console.
- Build and run (mvn clean install) the (second) test project
Expected behavior: The (second) test project builds and tests pass successfully.
Actual behavior: There is an error for Strings.js
Reproduces how often: Always
Component/s: typescript/vropkg
Affects Build/s: [Which are the Build Tools for VMware Aria releases / builds affected by the issue]
Environment
Client
- Build Tools for VMware Aria Version: 2.43.0
- Visual Studio Code Version: 1.98.2
- OS Version: Windows 11
Dependencies
Run: curl -o- https://raw.githubusercontent.com/vmware/build-tools-for-vmware-aria/main/health.sh | bash
and paste the output here:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2877 100 2877 0 0 7173 0 --:--:-- --:--:-- --:--:-- 7192
Starting VMware Aria Build Tools Checks...
Starting VMware Aria Build Tools Checks...
✔ Node.js version 22.14.0 is within the required range (22 - 22).
✔ Maven version 3.9.9 meets the minimum requirement (>= 3.9).
✔ Java version 17.0.11 is within the required range (17 - 21).
All checks passed successfully.
Server
- vRealize Automation Version:
- vRealize Orchestrator Version:
- vRealize Operations Version:
- vRealize Log Insight Version: