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.

What does this sentence in the readme actually mean ("...use your imagination ...")

See original GitHub issue

I consider this a documentation bug:

If you want to simulate asynchronous behavior, you have to use your imagination when calling the various functions.

This is ambiguous (and seems wrong to me) in a lot of ways. Please explain what exactly this is supposed to mean.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
benjamingrcommented, Mar 18, 2021

As JS is a language that in its concept runs atop an event-loop to allow manage async proceses in the background and scheduling/dispatching events in this way.

It is just that, I like it when talking about technical things to be precise and correct. I don’t think anyone is helped with things that don’t really make sense.

I hate to be that pedantic person but until ES2015 it was impossible to write async software in JavaScript.

The async bit came from the host environment. Even in ES2015 the async part is only “run to completion” microtask semantics and “real” asynchronicity comes from the platform.

You can plainly see this by looking at the fake-timers source code and seeing that there are a bunch of if/else depending on what platform we run on (since Node implements its own timers and the web implements the web timers spec). You can also trust me as both a maintainer here and a Node.js member (and also a WHATWG one, but I haven’t actually contributed to the timers spec) - but I am happy to provide references to any/all this.


Regardless of the technical/pedantic bit - please assume good faith (and competence) from maintainers of free libraries you use 😃

You are of course welcome to contribute docs back (please do) or (try and) pay Christian (or other people) to improve them.

(As a side note, we have a lot of “leaves a lot to be desired” docs in all other projects I’m a part of)

2reactions
mantonicommented, Mar 18, 2021

Maybe I can help resolving the misunderstanding here.

It’s obviously possible to run async code in JS, and That was always the case. We can all agree on that. It’s also clear that test can be written that test this async behavior.

However, with the Sinon fake timers, it’s also possible to program the clock and cause timer invocations to be triggered by the test synchronously. When developers opt into doing this, they make assumptions about timings and how the Event queue works. While this is trivial in most cases, it’s easily possible to make wrong assumptions and cause code execution orders in tests that aren’t possible in “real life”.

Christians comment was referring to this fact, maybe in a not very clear way, back in the day, when Sinon was a young project, used by just a few. We’re aiming to have better documentation, now that Sinon matured and is used by a broad user base.

We’re just a handful of developers who do this in their spare time. I’d like to invite you to contribute to the documentation wherever you feel like things could be expressed more clearly.

❤️

Read more comments on GitHub >

github_iconTop Results From Across the Web

USE YOUR IMAGINATION (phrase) definition and synonyms
used for telling someone that the answer to a question is very obvious and does not need to be given. Synonyms and related...
Read more >
writing-cheat-sheet/README.md at master - GitHub
Parenthesis can be used to insert an afterthought or explanation (a word, phrase, or sentence) into a passage that is grammatically complete without...
Read more >
There is a question 'Do you read me?' in the meaning 'Can ...
means you are being asked if you can actually hear the words being spoken to you clearly. The answer to the both questions...
Read more >
Why You Should Write in Markdown - chambers.io
This means the characters that appear on your screen are exactly the characters that your computer writes to the file on your hard...
Read more >
What Jane Austen and HBO have in common.
Jane Austen's famous opening sentence (“It is a truth universally ... The America of the world's imagination is Hollywood—meaning the tonier ...
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