fix: expose vm context directly from test envs#9428
Merged
Conversation
e2ab86d to
0f52b41
Compare
Codecov Report
@@ Coverage Diff @@
## master #9428 +/- ##
==========================================
- Coverage 65.04% 65.03% -0.02%
==========================================
Files 283 283
Lines 12088 12093 +5
Branches 2983 2984 +1
==========================================
+ Hits 7863 7865 +2
- Misses 3589 3591 +2
- Partials 636 637 +1
Continue to review full report at Codecov.
|
21 tasks
ExE-Boss
approved these changes
Jan 19, 2020
Member
Author
|
#9431 (comment) ditto |
This was referenced Jan 28, 2020
This was referenced Feb 4, 2020
This was referenced Feb 18, 2020
This was referenced Mar 3, 2020
This was referenced Mar 10, 2020
This was referenced Mar 24, 2020
This was referenced Apr 16, 2020
This was referenced Apr 30, 2020
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
I've been looking into ES Modules and what it'd take, and one thing is passing in a
contextwhen constructing it (see https://nodejs.org/api/vm.html#vm_class_vm_module). Since I've just addedcompileFunctionnext torunScriptadding yet another function seemed silly. So I've removedcompileFunction(never released anyways) and added a method which exposes the rawvm.Context. This matches what JSDOM has done (which I suppose is the motivation for the originalrunScriptimplementation - JSDOM previously only hadrunVMScript()), see jsdom/jsdom#2768. Note that we cannot upgrade to JSDOM@16 yet since they've dropped support for Node 8. I've created https://www.npmjs.com/package/jest-environment-jsdom-sixteen though (which currently hascompileFunction- I'll change togetVmContextshortly).Relates to #9252.
Test plan
Green CI