Skip to content

Commit ef9048c

Browse files
authored
Merge pull request #328 from lo1tuma/shadow-unit-test
Add unit tests to verify the correct reference is analyzed for shadowing
2 parents 6f2c628 + ed3043c commit ef9048c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/rules/no-mocha-arrows.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ ruleTester.run('no-mocha-arrows', rules['no-mocha-arrows'], {
2222
// In those examples, `it` is not a global.
2323
'function it () {}; it(() => { console.log("okay") })',
2424
'function it () {}; it.only(() => { console.log("okay") })',
25-
'function it () {}; it(() => {}); it(() => {});'
25+
'function it () {}; it(() => {}); it(() => {});',
26+
'foo("", () => {}); const it = () => {}; it("", () => {});'
2627
],
2728

2829
invalid: [
@@ -95,6 +96,11 @@ ruleTester.run('no-mocha-arrows', rules['no-mocha-arrows'], {
9596
code: 'it(/*one*/async/*two*/(done)/*three*/=>/*four*/assert(something, false))',
9697
errors,
9798
output: 'it(/*one*/async function/*two*/(done)/*three*//*four*/ { return assert(something, false); })'
99+
},
100+
{
101+
code: 'const foo = () => {}; foo("", () => {}); it(() => { assert(something, false); })',
102+
errors: [ { message: expectedErrorMessage, column: 42, line: 1 } ],
103+
output: 'const foo = () => {}; foo("", () => {}); it(function() { assert(something, false); })'
98104
}
99105
]
100106

0 commit comments

Comments
 (0)