Skip to content

Commit

Permalink
Add unit tests to verify the correct reference is analyzed for shadowing
Browse files Browse the repository at this point in the history
  • Loading branch information
lo1tuma committed May 27, 2022
1 parent 6f2c628 commit ed3043c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/rules/no-mocha-arrows.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ ruleTester.run('no-mocha-arrows', rules['no-mocha-arrows'], {
// In those examples, `it` is not a global.
'function it () {}; it(() => { console.log("okay") })',
'function it () {}; it.only(() => { console.log("okay") })',
'function it () {}; it(() => {}); it(() => {});'
'function it () {}; it(() => {}); it(() => {});',
'foo("", () => {}); const it = () => {}; it("", () => {});'
],

invalid: [
Expand Down Expand Up @@ -95,6 +96,11 @@ ruleTester.run('no-mocha-arrows', rules['no-mocha-arrows'], {
code: 'it(/*one*/async/*two*/(done)/*three*/=>/*four*/assert(something, false))',
errors,
output: 'it(/*one*/async function/*two*/(done)/*three*//*four*/ { return assert(something, false); })'
},
{
code: 'const foo = () => {}; foo("", () => {}); it(() => { assert(something, false); })',
errors: [ { message: expectedErrorMessage, column: 42, line: 1 } ],
output: 'const foo = () => {}; foo("", () => {}); it(function() { assert(something, false); })'
}
]

Expand Down

0 comments on commit ed3043c

Please sign in to comment.