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

Allow concatenation when ensuring assertion message is a string #332

Open
Yash-Singh1 opened this issue Sep 6, 2021 · 1 comment
Open

Comments

@Yash-Singh1
Copy link

Currently, doing:

t.notThrowsAsync(asyncNotThrowingFn, 'abc' + someString)

Would fail, saying that the assertion message is not a string. This is happening over here:

function isString(node) {

The function should also support concatenation. Looking at the AST Explorer, I think that the function should run recursively and recheck its left and its right to ensure that they are either a Binary Expression or a String Literal, or an Identifier.

@sindresorhus
Copy link
Member

I think we can make it better by using getStaticValue there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants