JavaScript Debugging Configuration
Question:
Is there a setting either in the local browser, in RTC, or on the server to enable debugging of javaScript code?
Problem:
I am having trouble getting the debugger to stop on a break point or console log to print information within a getValue function.
Below is some code that I will refer to. This code is an example of what is running on different servers and in different projects. Each instance is behaving the same way.
I am running 6.0.3 server. This happens when viewing a work item using either Firefox or Internet Explorer on Windows and also using Firefox from Linux. Another user on the team sees the same behavior.
Behavior Clarification:
When the script executes the browser console view shows the "Running Script..." line but not the "Hello value..." line.
I can set a breakpoint in the debugger and get the execution to pause on any line within the outer function and up to and including the line beginning with "getValue: ...".
If I set a breakpoint on any line after this line it will not break.
When the script executes to completion, the attribute value is updated with the "Hi There" so I know the script executes to completion.
If I set a breakpoint on the first console.log line ("Running Script...") The debugger shows two instances of the showHelloWorldValue.js script. One labeled (eval) and the other labeled (anonymous).
Using the step debug button does not result in getting into the function. The program pointer switches from one instance to another thus resetting the program pointer back to the opening "{" of the other instance. Then it skips to the "}" before allowing both functions to go out of scope.
Code:
dojo.provide("showHelloWorldValue");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
var scriptName = "showHelloWorldValue";
console.log("Running Script - " + scriptName);
dojo.declare(scriptName, null, {
getValue: function(attribute,workItem, configuration) {
var hello = workItem.getValue("helloWorld");
console.log("Hello Value: " + hello);
hello = "Hi there";
return hello;
}
});
})();
One answer
JavaScript code is compressed to reduce overhead or something. You need to use a special debug URL.
See the article in the library for debugging
-
https://jazz.net/library/article/1360 section "Test it"
Comments
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Apr 17 '18, 7:52 a.m.I find the line
console.log("Running Script - " + scriptName);
Strange. Is it allowed to have logging out side of the function definition.