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

improve test coverage for calling classes without the new keyword #557

Closed
wants to merge 6 commits into from

Conversation

Carnubak
Copy link
Contributor

While looking into #161 I noticed that several tests for the constructions of objects were not checking the message from the expected exception, which caused a couple of bugs to be missed (and some lines not to be covered).

I improved the tests and corrected the bugs, and also added similar tests to all constructable classes that were making the "invoke with new" check. I also standardized the test message and the general structure, since different tests seemed to be handling it with different naming conventions for the auxiliary variables.

@@ -6,7 +6,7 @@ var BAIL_ERROR = new Error();
module.exports = Concurrent;

function Concurrent(tests, bail) {
if (!this instanceof Concurrent) {
if (!(this instanceof Concurrent)) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm surprised the linter didn't catch this. Would have thought ESLint would have rule for this.

@sindresorhus sindresorhus changed the title Pr/code coverage improve test coverage for calling classes without the new keyword Feb 16, 2016
@sindresorhus
Copy link
Member

Good catch! Thank you. Keep'em coming ;)

@Carnubak Carnubak deleted the pr/code-coverage branch February 16, 2016 13:20
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.

2 participants