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.

Timing issue with tests

See original GitHub issue

Regarding our discussion here, there is a still a timing issue of some sort with the tests.

Yes, lastState exists, but stateNumber console twice when stateNumber===1. I don’t know why it executes twice, but this is the reason for the tes

It doesn’t run twice for stateNumber===1 - I was able to change it back without problems and the test still runs green… it’s what I mentioned earlier - there is some kind of timing issue still, and somehow, calling console.log at the right moment fixes the problem.

So console.log somehow has side-effects affecting the timing here - I don’t have an explanation, but it’s completely repeatable: remove the console.log statement and the test fails - leave it in there and it passes. This is a real JavaScript moment. I can feel my brain melting. 😶

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
mindplay-dkcommented, Dec 12, 2019

Let’s leave this issue here until we see if tape changes anything.

2reactions
yisarcommented, Dec 12, 2019

I suspect this is a unique bug of jest. console.log is a time-consuming behavior, which plays a role of delaying time.

Unfortunately, I can’t find the reason of it. We temporarily hack it, and then spend some time waiting for the reason to be revealed

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Diagnose Timing Issues on a Standardized Test
Look for changes in time spent, and see if they correlate to shifts in difficulty levels of the questions. You generally want to...
Read more >
ANALYSIS AND DETECTION OF TIMING FAILURES IN AN ...
ABSTRACT. A 25k gate Test Chip was designed and manufactured to evaluate different test methods for scan-designed circuits. The design of the chip, ......
Read more >
Timing Problem During Test : General GMAT Questions and ...
I am struggling with timing very badly . In Gmatclub practice questions my average time is below 2 minutes but whenever i am...
Read more >
Unit Test timing is wrong - Visual Studio Feedback
Thus, I think the timing issue is tied to having a mix of MS Test projects and xUnit test projects. I hope this...
Read more >
Unit testing EventArgs - will there be timing issues?
This works and all tests pass, but: Can't I run into timing issues here? As I understand I call my method MissThrow() and...
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