Le 18/12/2013 21:13, Dave Hylands a écrit :
> 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.
>

Yeah, there are exceptions. I already said about IndexedDB stuff,
DeviceStorage is another one.

Actually I was really talking about unit tests. Testing APIs is another
story, as are integration tests.

-- 
Julien

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to