Skip to content

Support err.code in t.throws() expectation #1712

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

Merged
merged 4 commits into from
May 30, 2018

Conversation

jamiebuilds
Copy link
Contributor

Resolves #1708

t.throws(() => {
  fs.readFileSync('./example.txt');
}, { code: 'EACCES' });

Copy link
Member

@novemberborn novemberborn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thanks @jamiebuilds.

Just need an assertion for a bad code value in the expectation object: https://github.com/jamiebuilds/ava/blob/f95b175bcd7218eb0b65b8ddbe8a48ca11138c32/test/assert.js#L977

@novemberborn novemberborn merged commit 179f26a into avajs:master May 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants