Skip to content

Commit

Permalink
[Tests] no-cycle: add passing test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
georeith authored and ljharb committed Apr 21, 2022
1 parent 7be127d commit dc4ed22
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/files/cycles/ignore/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"import/no-cycle": 0
}
}
2 changes: 2 additions & 0 deletions tests/files/cycles/ignore/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { foo } from "../depth-zero";
export { foo };
2 changes: 2 additions & 0 deletions tests/files/cycles/intermediate-ignore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import foo from "./ignore";
export { foo };
18 changes: 18 additions & 0 deletions tests/src/rules/no-cycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,5 +267,23 @@ ruleTester.run('no-cycle', rule, {
parser: parsers.BABEL_OLD,
errors: [error(`Dependency cycle via ./flow-types-depth-two:4=>./es6/depth-one:1`)],
}),
test({
code: 'import { foo } from "./intermediate-ignore"',
errors: [
{
message: 'Dependency cycle via ./ignore:1',
line: 1,
},
],
}),
test({
code: 'import { foo } from "./ignore"',
errors: [
{
message: 'Dependency cycle detected.',
line: 1,
},
],
}),
),
});

0 comments on commit dc4ed22

Please sign in to comment.