Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Breaking] support passing in an async function for the test callback #472

Merged
merged 3 commits into from
Dec 18, 2019

Commits on Jun 20, 2019

  1. [Breaking] support exceptions in async functions

    This change makes tape work the same with synchronous
    and asynchronous functions.
    
    ```
    test('my test', () => {
      throw new Error('oopsie')
    })
    
    test('my async test', async () => {
      throw new Error('oopsie')
    })
    ```
    
    These two cases now have the same semantics which means you
    can safely use an async function because the unhandled rejection
    will be converted into a thrown exception.
    
    Failing a test when the return promise rejected will fail a test
    that was probably silently broken previously.
    
    Extra test cases have been added to reflect real world usage
    of tape with async functions which we preferably do not want to
    break.
    Raynos authored and ljharb committed Jun 20, 2019
    Configuration menu
    Copy the full SHA
    8d3f03a View commit details
    Browse the repository at this point in the history

Commits on Jun 24, 2019

  1. [Breaking] if a test callback returns a rejected thenable, fail the t…

    …est.
    
    Also, implicitly call `.end()` if not already called when a Promise is returned, because the promise itself marks the end of the test.
    ljharb committed Jun 24, 2019
    Configuration menu
    Copy the full SHA
    f248610 View commit details
    Browse the repository at this point in the history

Commits on Jul 2, 2019

  1. Configuration menu
    Copy the full SHA
    197019c View commit details
    Browse the repository at this point in the history