Automattic / Automattic/expect.js

Change readme exception example

Open
#13 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.1k
Forks
207
PR merge metrics
No merged PRs in 30d

Description

I would change this:

``` javascript
expect(fn).to.throwException(function (e) { // get the exception object
expect(e).to.be.a(SyntaxError);
});
```

to

``` javascript
expect(fn).to.throwException(function (e) { // get the exception object
expect(e.constructor).to.be(SyntaxError);
});
```

to ignore inheritance. It surely depends on the test, but I think that you usually want to test for a specific exception, not a "kind of" exception.

Just a suggestion ... :)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.