eslint-plugin-ava
eslint-plugin-ava copied to clipboard
Allow concatenation when ensuring assertion message is a string
Currently, doing:
t.notThrowsAsync(asyncNotThrowingFn, 'abc' + someString)
Would fail, saying that the assertion message is not a string. This is happening over here:
https://github.com/avajs/eslint-plugin-ava/blob/dee1802d39e22aec0915d5067062356f5abfbd84/rules/assertion-arguments.js#L206
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.
I think we can make it better by using getStaticValue there.