130
edits
(Removing the custom asyncTest function with the native add_task) |
|||
| Line 100: | Line 100: | ||
Here are a few things to keep in mind with regards to asynchronous testing: | Here are a few things to keep in mind with regards to asynchronous testing: | ||
* head.js already calls waitForExplicitFinish() so there's no need for your new test to do it too | * head.js already calls waitForExplicitFinish() so there's no need for your new test to do it too. | ||
* Using | * Using add_task with a generator function means that you can yield calls to functions that return promises. It also means your main test function can be written as synchronous code would be, simply adding yield before calls to asynchronous functions. Here is, for example, a for loop: | ||
for (let i = 0; i < testData.length; i ++) { | for (let i = 0; i < testData.length; i ++) { | ||
edits