Anish Reghu
Kilo Sage

Dear coders, developers,

 

Hope everyone's doing good ...

This feature exists since Paris. Can you believe it?

A gem which was truly hidden.

Read further to truly understand what I mean by saying it as a "gem".

A BIG time saver!

Many experts might know it, but tools like this, really makes the platform so very competent and such a breather for both learners and developers. 

"JS Code Coverage Debug" 

  •  No need to set breakpoints OR
  • Even review on screen debug messages. 

sys_js_code_coverage.LIST

This place or records listed here gets you an insight of which lines of code did run/execute during a user session.

Following are the details captured: 

  • The user session that called the script.
  • The script record the system called identified by table, sys_id, and script field.
  • The script record the system called identified by type and name.
  • The transaction that called the script.
  • The start time of the transaction.
  • The contents of the script field highlighted to indicate which lines the system ran. 

[GREEN - executed, RED - skipped, GREY - non-executable.] 

 

Activate the plugin - "com.glide.js.coverage" and save your time, if you are yet to do it. Hurry up!!!

 

Navigation - JS Code Coverage Debug > Enable Coverage. 

 

Check out the following screenshot when an incident is inserted.

 

find_real_file.png

This clear distinction between the lines of code that did execute and the ones that did not,  I know many developers feel relaxed by now. Keep using and exploring the platform.

 

Do post in comments, if you knew this already and share your experience.

 

 

Best of luck with your debugging!

Cheers,

Anish Reghu

Comments
Mwatkins
ServiceNow Employee
ServiceNow Employee

Love it! Thanks for posting.

Here's the product doc link: JS Code Coverage Debug

Anish Reghu
Kilo Sage
The product documentation holds some key information, should we be ready to sit down, have patience and read through it during our weekends or leisure time. Truly, certain topics have surprised me that people, even myself have asked in the community and it was clearly, very clearly stated in the Product docs. Hats off to the content team in ServiceNow.
John Dahl
Kilo Sage

This is very cool! I can see this becoming a big problem if not managed, but it can be very useful for troubleshooting and development! I love that you do not have to have it always running. You can turn it on, reproduce an issue that was reported, turn it off, then go back and review the data of the scripts that ran during the reproduction.

Anders Pr_stega
Tera Expert

Really great - thank you for sharing!

-Anders

Anish Reghu
Kilo Sage

Welcome 🙂

Ohki_Yamamoto
Tera Guru

Thank you!

Is it possible for JS Code Coverage Debug to measure coverage at the C1 level?
Is GREEN at the C0 level?

Version history
Last update:
‎05-13-2022 10:15 AM
Updated by: