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

Ensure the assertion message is a string #314

Merged
merged 2 commits into from
Dec 24, 2020

Conversation

GMartigny
Copy link
Contributor

@GMartigny GMartigny commented Dec 4, 2020

This will check for the presence of the extra argument (which should be the message) and verify if it's a string.
It will try to lookup variable and its value in the scope, but non-linear flow could break it.

let message;
function woops () {
	message = null;
}
message = 'ok';
woops();
t.is('same', 'same', message); // <= this will not raise an error

Should we cover this ?

Fixes #167


IssueHunt Summary

Referenced issues

This pull request has been submitted to:


@sindresorhus
Copy link
Member

Should we cover this ?

No. Too hard to get right and too much of an edge-case.

@sindresorhus sindresorhus changed the title Add check for the assertion message to be a string Ensure the assertion message is a string Dec 24, 2020
@sindresorhus sindresorhus merged commit ae54195 into avajs:master Dec 24, 2020
@GMartigny GMartigny deleted the validateMessageType branch December 24, 2020 08:01
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.

The assertion-arguments rule should validate message argument type
2 participants