expect-to-throw

Method to expect that an async function throws

Usage no npm install needed!

<script type="module">
  import expectToThrow from 'https://cdn.skypack.dev/expect-to-throw';
</script>

README

Build Status

expect-to-throw

Just a method to expect an async method to throw

const expectToThrow = require('expect-to-throw')

describe('some method', function(){
    it('must throw', async function(){
        await expectToThrow(async function(){
            await someMethod()
        })
    })
})