• Sathya Gunasekaran's avatar
    [tests] Async test framework · 61ed6a00
    Sathya Gunasekaran authored
    - No need for multiple assertAsyncRan() calls, just do t.plan(count)
    
    - Previously, if you forget to call assertAsyncRan(), the test will still
      pass, which is no longer true.
    
    - No longer hold global state (with
      asyncAssertsExpected). Previously if one assert wasn't hit then
      there's no way to find out which test failed. You'd have to
      comment each test and try again.
    
    - Each test runs independently in the microtask queue.
    
    - Better failure reporting by printing the entire function.
    
    Example error :
    === mjsunit/harmony/promise-prototype-finally ===
    abort: Expected asserts: 2, Actual asserts: 1
    in test: reject/finally/then
    assert => {
      assert.plan(2);
      Promise.reject(3).finally().then(
        assert.unreachable,
        x => {
          assert.equals(3, x);
        });
    }
    
    
    Change-Id: Ic3f6272e1e87b8b0121b8c8c7cce19cf90d1f1be
    Reviewed-on: https://chromium-review.googlesource.com/455555
    Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
    Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
    Reviewed-by: 's avatarDaniel Ehrenberg <littledan@chromium.org>
    Reviewed-by: 's avatarCaitlin Potter <caitp@igalia.com>
    Cr-Commit-Position: refs/heads/master@{#46910}
    61ed6a00
promise-prototype-finally.js 11.2 KB