question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how do you debug a tst file?

See original GitHub issue

HI @frhagn

I have the following in .tst file and I would like to be able to console.log stuff so I can see what I am working with. Is that possible?

${
    string KnockoutType(Property p) {
        if (p.Type.IsEnumerable) {
console.log($p.Type);
            return p.Type.Name.TrimEnd('[',']');
        }

        return p.Type;
    }

thanks.

I am trying to use a 2 dimensional array in C# and converting that to a knockout observable array, but what appears to be happening is that Property.Type only has a single [] but $Type within a property section seems to have the proper [][]. So I would like to dump out these values to see what I am working with.

Thanks Greg

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
banyardcommented, Jul 8, 2016

There may be a better solution but in terms of general debugging with Typewritter I usually append information to a string then output this within a comment in my template. Something like:

${
     static string debugInfo = "";
     string PrintDebugInfo(File f){
          return debugInfo;        
     }

     string KnockoutType(Property p) {
          if (p.Type.IsEnumerable) {
               debugInfo = p.Type.ToString();
               return p.Type.Name.TrimEnd('[',']');
          }
          return p.Type;
     }
}
/* 
     Debug Info:
     $PrintDebugInfo
/*
9reactions
aluanhaddadcommented, Jan 18, 2017

@sonuautade Yeah, but it is better than nothing.

@frhagn Would it be possible to have a way to print message via System.Diagonistics.Debug.WriteLine or, better yet, to have a flexible logging mechanism such as

${
    using Typewriter.Extensions.Types;
    using static System.Diagonistics.Debug;

    Template(Settings settings)
    {
        settings.UseLog(WriteLine);
    }
}

I’d be happy to create a PR for that if it sounds reasonable/feasible

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you debug Jest Tests?
Right-click on the icon next to the name of the test in the test file. In the menu that opens, click on Debug...
Read more >
Debug unit tests with Test Explorer - Visual Studio (Windows)
In Test Explorer, select the test method(s) and then choose Debug on the right-click menu. Test execution details. For more information, about ...
Read more >
How To Debug a Single Test Case
From the Run and Debug menu, select the debug configuration you created earlier and click Start Debugging. A new JavaScript debug terminal opens ......
Read more >
Debugging a Test Script
To debug a script that is not currently active in the editor, click File > Debug. To debug the active script, click Run...
Read more >
Debug a test, component, function library, or user code file
Select Tools > Options > API Testing tab > General node and then select Run test in debugging mode. Back to top. Slow...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found