This repository has been archived by the owner on Aug 15, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update: support new export syntax (#56)
- Loading branch information
1 parent
dbddf14
commit d4a3764
Showing
3 changed files
with
50 additions
and
1 deletion.
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
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,37 @@ | ||
"use strict"; | ||
|
||
const assert = require("assert"); | ||
const espree = require("espree"); | ||
const { KEYS } = require("eslint-visitor-keys"); | ||
const { analyze } = require("../lib/index"); | ||
|
||
describe("export * as ns from 'source'", () => { | ||
let scopes; | ||
|
||
beforeEach(() => { | ||
const ast = espree.parse("export * as ns from 'source'", { | ||
ecmaVersion: 2020, | ||
sourceType: "module" | ||
}); | ||
const manager = analyze(ast, { | ||
ecmaVersion: 11, | ||
sourceType: "module", | ||
childVisitorKeys: KEYS | ||
}); | ||
|
||
scopes = [manager.globalScope, ...manager.globalScope.childScopes]; | ||
}); | ||
|
||
it("should not have any references", () => { | ||
for (const scope of scopes) { | ||
assert.strictEqual(scope.references.length, 0, scope.type); | ||
assert.strictEqual(scope.through.length, 0, scope.type); | ||
} | ||
}); | ||
|
||
it("should not have any variables", () => { | ||
for (const scope of scopes) { | ||
assert.strictEqual(scope.variables.length, 0, scope.type); | ||
} | ||
}); | ||
}); |