benjamn / benjamn/ast-types

Scope constructor `instanceof` check

Open
#144 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.2k
Forks
194
Avg merge
22h 43m
Merged PRs (30d)
10

Description

When writing Jest unit tests for a jscodeshift codemod (https://github.com/cpojer/js-codemod/pull/2) the [Scope constructor `instanceof` check](https://github.com/benjamn/ast-types/blob/master/lib/scope.js#L14) fails, I haven't fully tracked down whats causing it (maybe related to running in a child process) but i can see the transform is working fine locally via jscodeshift or via http://astexplorer.net/#/LDGg3pg5ne

What is the purpose of this check? Im wondering if it can be achieved another way? i'm happy to do a PR if you're cool with changing it.

cc @cpojer @benjamn

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Scope constructor `instanceof` check in lib/scope.js at line 14 and reproduce the failure in the Jest unit tests for the jscodeshift codemod. Compare that behavior with running the transform through jscodeshift and astexplorer.net. Done means the purpose and cause of the failing check are established and the test behavior is resolved without breaking the transform.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.