-
Notifications
You must be signed in to change notification settings - Fork 581
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
global test case variables in feature tests #1956
Comments
Did you mean Whichever one you are using it looks like you are reusing a context since that is the only way that
'use strict';
global.x = 1;
x = 2; // OK
y = 3; // ReferenceError |
Sorry, Shouldn't we be running these tests in IIFE or loading them as modules anyway? |
It's possible vm and/or V8 has bugs here :-/. Minimal repros appreciated. These seem potentially related. nodejs/node#769 nodejs/node-v0.x-archive#9084 nodejs/node#548 Especially nodejs/node-v0.x-archive#9084 (comment) |
Definitely not. Script code has different semantics than Module and FunctionBody. |
Simplify.js: Global vars creates properties on the global (in Script). What we probably should do is to create a new context for every test but I am concerned about the performance of doing that. |
Context creation is much faster in io.js 2.0.2 onward now that snapshots have been re-enabled. |
Sure. But nothing is going to beat global eval. Still, if the performance regression of the tests is acceptable it would be a lot better to use new contexts to remove interdependencies. |
I'm still unclear. Consider this Script:
Followed by this one:
It's my understanding that after the second script completes we should assert. If we execute these in the other order, we should not assert. Thus I believe the test is incorrect: we can't assert b is undefined because we don't know the status of the global |
I agree with you. The tests sometimes break due to changes in other files. When that happens a more unique name is usually used. |
In the case of the Simplify test, the |
I've reworked the feature test harness into es6 but one of the tests won't pass. It transcodes to:
Here is the output
The new version uses V8
runInTheContext
which purports to resemble(0,eval)('code')
, essentially the call used in the older version. It seems this isn't quite true.I'm not surprised that we somehow polluted the global space with values
a, b,c
, but I am surprised that combination of"use strict"
andvar a;
did not save us.Anyway any suggestions? Of course I could force the tests to run again with
eval()
but I was hoping to use the same code for all the node evaluations.The text was updated successfully, but these errors were encountered: