Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure circular
export * from X
does not stack overflow (#2836)
closes #2815
- Loading branch information
1 parent
67a717b
commit 3596f1f
Showing
5 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const assert = require('assert'); | ||
|
||
module.exports = { | ||
description: 'does not stack overflow on `export * from X` cycles', | ||
code(code) { | ||
assert.equal( | ||
code, | ||
`'use strict';\n\nfunction b() {\n\treturn 'b';\n}\n\nassert.equal(b(), 'b');\n` | ||
); | ||
}, | ||
warnings: [ | ||
{ | ||
code: 'CIRCULAR_DEPENDENCY', | ||
importer: 'a.js', | ||
message: 'Circular dependency: a.js -> b.js -> a.js' | ||
} | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export * from './b.js'; | ||
|
||
export function a() { | ||
return 'a'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export * from './a.js'; | ||
|
||
export function b() { | ||
return 'b'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { b } from './a.js'; | ||
|
||
assert.equal(b(), 'b'); |