Skip to content

Commit

Permalink
[Tests] no-cycle: Add tests for commonjs imports
Browse files Browse the repository at this point in the history
  • Loading branch information
soryy708 authored and ljharb committed Oct 24, 2019
1 parent 4a8b191 commit 238fb4e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tests/files/cycles/cjs/depth-one.js
@@ -0,0 +1,2 @@
var foo = require("../depth-zero")
module.exports = { foo }
5 changes: 5 additions & 0 deletions tests/files/cycles/cjs/depth-three-indirect.js
@@ -0,0 +1,5 @@
require('./depth-two')

module.exports = function bar() {
return "side effects???"
}
2 changes: 2 additions & 0 deletions tests/files/cycles/cjs/depth-three-star.js
@@ -0,0 +1,2 @@
var two = require("./depth-two")
module.exports = { two }
2 changes: 2 additions & 0 deletions tests/files/cycles/cjs/depth-two.js
@@ -0,0 +1,2 @@
var { foo } = require("./depth-one")
module.exports = { foo }
2 changes: 1 addition & 1 deletion tests/src/rules/no-cycle.js
Expand Up @@ -12,7 +12,7 @@ const test = def => _test(Object.assign(def, {
filename: testFilePath('./cycles/depth-zero.js'),
}));

const testDialects = ['es6'];
const testDialects = ['es6', 'cjs'];

ruleTester.run('no-cycle', rule, {
valid: [].concat(
Expand Down

0 comments on commit 238fb4e

Please sign in to comment.