Skip to content

Commit

Permalink
Merge pull request #328 from lo1tuma/shadow-unit-test
Browse files Browse the repository at this point in the history
Add unit tests to verify the correct reference is analyzed for shadowing
  • Loading branch information
lo1tuma authored May 27, 2022
2 parents 6f2c628 + ed3043c commit ef9048c
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 ef9048c

Please sign in to comment.