Giter VIP home page Giter VIP logo

Comments (3)

japgolly avatar japgolly commented on August 27, 2024

I've found out why. In BaseRunner.scala#L61, getClassName returns <jscode> for every stack trace frame.

I also tried and failed with these:

  • .getClass.getName - returns java.lang.StackTraceElement for every frame.
  • .getClass.getSimpleName - returns StackTraceElement for every frame.
  • .getClass.getCanonicalName - not implemented in SJS.
  • .getClass.getTypeName - not implemented in SJS.
  • .getClass.getPackage.getName - not implemented in SJS.

from utest.

sjrd avatar sjrd commented on August 27, 2024

.getClassName is the right thing. It has nothing to do with getClass.getName. See StackTraceElement

However getClassName is quite unreliable. We basically try to recover this information from the VM's stack trace, which is a string with a format varying from VM to VM, and from version to version ^^. The recovery heuristics are in StackTrace. Sometimes the VM's stack trace doesn't even contain the class name, in which case there's nothing we can do.

getMethodName is pretty reliable. getFileName as well, but doesn't apply source maps in all VMs, such as PhantomJS.

The most reliable way to cut such a stack trace is to have a method with a pretty unique and recognizable name, which you can identify with getMethodName.

from utest.

lihaoyi avatar lihaoyi commented on August 27, 2024

This should be fixed in master by 2810c62#diff-910ec1813f88878eb7ec68c377062fb0 and the follow up f38bd2b#diff-910ec1813f88878eb7ec68c377062fb0, which uses getClassName and getMethodName to decide on stack trace cutoff, and @noinline to try and make sure Scala.js doesn't make the marker methods disappear

from utest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.