-
-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
REPL, -e
, and piped stdin globals are wrong: ,missing exports
, module
, etc.
#1282
Comments
Seems this bit of code, which only runs when you call |
Did some more research here.
node -e '< expression >' gets access to a bunch of variables added to the global object. I did a test logging the set of fields on
The modules like
stdin and
Looks like we need to do these things:
|
Also must be sure
|
Discrepancy between:
node treats the positional as an argv string, does NOT attempt to execute it.
|
Our repl does |
ts-node --interactive -e
evaluates -e
expression without exports
, module
, etc.-e
, and piped stdin globals are wrong: ,missing exports
, module
, etc.
Renamed to capture scope of this ticket. |
…1333) * add failing tests * remove log statement from test * add detailed tests for globals in <repl>, [stdin], and [eval] * WIP fixing * more WIP * update tests * WIP * update packagelock * fix tests * Fix and tests * fix test failure on windows * fix programmatic test to cleanup potentially-polluted env prior * modifying programmatic repl test to call out that `module` is unavailable before repl is started * Update tests for Windows env * Fix tests * add retries around npm install in tests on windows * lintfix
Expected Behavior
ts-node --interactive -e "<expression>"
should behave the same asnode --interactive -e "<expression>"
-e
should be evaluated withexports
, etc.Actual Behavior
exports
is not defined during the evaluation of a-e
expression.Steps to reproduce the problem / Minimal reproduction
Notes
Looks like a blind spot in our REPL logic in
bin.ts
We should check that all the module-specific variables,exports
,__filename
, etc match nodejs.The text was updated successfully, but these errors were encountered: