Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

chai-vague-errors should check 2nd expect arg for an error description #207

Closed
philipbulley opened this issue Aug 31, 2016 · 1 comment · Fixed by #460
Closed

chai-vague-errors should check 2nd expect arg for an error description #207

philipbulley opened this issue Aug 31, 2016 · 1 comment · Fixed by #460
Labels
Difficulty: Medium People with non-trivial experience in TSLint should be able to send a pull request for this issue. Status: Accepting PRs Type: Rule Feature Adding a feature to an existing rule.
Milestone

Comments

@philipbulley
Copy link

It's possible to specify a custom error message via the second arg to expect()

// AssertionError: topic [answer]: expected 43 to equal 42.
expect(43, 'topic [answer]').to.equal(42);

But chai-vague-errors produces Found chai call with vague failure message. Please add an explicit failure message

With the 2nd arg messages, we can continue to use the fluent chai syntax:

expect(something, 'expected something to have occurred').to.be.true;

without having to resort to:

expect(something).to.equal(true, 'expected something to have occurred');

So, should chai-vague-errors accommodate 2nd arg messages?

@HamletDRC
Copy link
Member

Correct. We should support this but do not yet.

I think the rule should be coded to force one style or the other, but not have mixing both in the same project.

@HamletDRC HamletDRC changed the title Question: chai-vague-errors doesn't check 2nd expect arg chai-vague-errors should check 2nd expect arg for an error description Sep 2, 2016
@JoshuaKGoldberg JoshuaKGoldberg added Status: Accepting PRs Difficulty: Medium People with non-trivial experience in TSLint should be able to send a pull request for this issue. Type: Rule Feature Adding a feature to an existing rule. and removed Type: Enhancement labels Jul 4, 2018
JoshuaKGoldberg pushed a commit that referenced this issue Jul 20, 2018
…ule (#460)

(first PR... hopefully did it right). Hopefully this fixes this issue:

Fixes #207
@JoshuaKGoldberg JoshuaKGoldberg added this to the 5.2.0 milestone Aug 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Difficulty: Medium People with non-trivial experience in TSLint should be able to send a pull request for this issue. Status: Accepting PRs Type: Rule Feature Adding a feature to an existing rule.
Projects
None yet
3 participants