test: expand linting rules around `assert` w literal messages · nodejs/node@7e0a0fc

@@ -36,6 +36,10 @@ export default [

3636

selector: "CallExpression:matches([callee.name='deepStrictEqual'], [callee.property.name='deepStrictEqual'])[arguments.2.type='Literal']",

3737

message: 'Do not use a literal for the third argument of assert.deepStrictEqual()',

3838

},

39+

{

40+

selector: "CallExpression:matches([callee.name='notDeepStrictEqual'], [callee.property.name='deepStrictEqual'])[arguments.2.type='Literal']",

41+

message: 'Do not use a literal for the third argument of assert.notDeepStrictEqual()',

42+

},

3943

{

4044

selector: "CallExpression:matches([callee.name='doesNotThrow'], [callee.property.name='doesNotThrow'])",

4145

message: 'Do not use `assert.doesNotThrow()`. Write the code without the wrapper and add a comment instead.',

@@ -48,10 +52,18 @@ export default [

4852

selector: "CallExpression:matches([callee.name='rejects'], [callee.property.name='rejects'])[arguments.length<2]",

4953

message: '`assert.rejects()` must be invoked with at least two arguments.',

5054

},

55+

{

56+

selector: "CallExpression[callee.property.name='notStrictEqual'][arguments.2.type='Literal']",

57+

message: 'Do not use a literal for the third argument of assert.notStrictEqual()',

58+

},

5159

{

5260

selector: "CallExpression[callee.property.name='strictEqual'][arguments.2.type='Literal']",

5361

message: 'Do not use a literal for the third argument of assert.strictEqual()',

5462

},

63+

{

64+

selector: "CallExpression[callee.name='assert'][arguments.1.type='Literal']:not([arguments.1.raw=/['\"`].*/])",

65+

message: 'Do not use a non-string literal for the second argument of assert()',

66+

},

5567

{

5668

selector: "CallExpression:matches([callee.name='throws'], [callee.property.name='throws'])[arguments.1.type='Literal']:not([arguments.1.regex])",

5769

message: 'Use an object as second argument of `assert.throws()`.',