Hi Julien, > What I learnt for 1 year is that setTimeout should _never_ be used in tests. > Tests should _never_ be asynchronous. If you use setTimeout in code, > then use sinon's fake timers to linearize this code and make it synchronous.
And to prove that _never_ is sometimes not really _never_ (or there's always an exception), I wrote a device storage test where I need to use setTimeout (or sometype of sleeping function). The test needs to create files with different timestamps (as read by the filesystem). I'm no JS expert, so if there is a way to do this without using setTimeout, I'd be happy to change my test. Dave Hylands _______________________________________________ dev-b2g mailing list [email protected] https://lists.mozilla.org/listinfo/dev-b2g
