Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
use ecmaVersion:6 in the test
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjermanovic committed Jul 6, 2024
1 parent 1aa7901 commit b1f4a4b
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions tests/catch-scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ describe("catch", () => {
}());
`);

const scopeManager = analyze(ast);
const scopeManager = analyze(ast, { ecmaVersion: 6 });

expect(scopeManager.scopes).to.have.length(3);
expect(scopeManager.scopes).to.have.length(5);

const globalScope = scopeManager.scopes[0];

Expand All @@ -96,7 +96,13 @@ describe("catch", () => {
expect(functionScope.references[0].from).to.be.equal(functionScope);
expect(functionScope.references[0].resolved).to.be.equal(functionScope.variables[1]);

const catchScope = scopeManager.scopes[2];
const tryBlockScope = scopeManager.scopes[2];

expect(tryBlockScope.type).to.be.equal("block");
expect(tryBlockScope.variables).to.have.length(0);
expect(tryBlockScope.references).to.have.length(0);

const catchScope = scopeManager.scopes[3];

expect(catchScope.type).to.be.equal("catch");
expect(catchScope.variables).to.have.length(4);
Expand Down Expand Up @@ -133,6 +139,12 @@ describe("catch", () => {
expect(catchScope.references[0].resolved).to.be.equal(catchScope.variables[1]);
expect(catchScope.references[1].from).to.be.equal(catchScope);
expect(catchScope.references[1].resolved).to.be.equal(functionScope.variables[1]);

const catchBlockScope = scopeManager.scopes[4];

expect(catchBlockScope.type).to.be.equal("block");
expect(catchBlockScope.variables).to.have.length(0);
expect(catchBlockScope.references).to.have.length(0);
});
});

Expand Down

0 comments on commit b1f4a4b

Please sign in to comment.