This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Repository navigation
Enable snapshot - #37
Merged
Merged
Conversation
Contributor
Author
|
/cc: @nathansobo @maxbrunsfeld |
13 tasks done
Contributor
|
Looks cool. Nice solution. I'm a bit confused about the whole |
as-cii
force-pushed
the
as-support-snapshot
branch
from
March 2, 2017 15:14
9be3829 to
90dd485
Compare
Contributor
Author
Originally I was using it because |
ahutchings
added a commit
to jurassix/atom-javascript-refactor
that referenced
this pull request
Mar 4, 2017
As of version 2.10.0, fs-plus exports a Proxy object which cannot be automocked by Jest. See atom/fs-plus#37.
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.
This pull request changes fs-plus so that it can be required while generating a v8 snapshot. It does so by:
Proxyobject instead of creating a new object containing both fs-plus and fs methods. The nice thing about this approach is that it doesn't break the API which, as a result, allows us to not change the callers offs-plusin Atom.resolveOnLoadPathto usemodule.pathsonly if present. In the case of a snapshot we won't be able to provide the absolute resolution paths at require-time (i.e. they depend on the location where Atom is installed at and the snapshot is generated on a CI server), but we can still resolve them by usingsnapshotResult.entryPointDirPath.The downside of
Proxyobjects is that they're ~2x slower, so if you repeatedly callfs-plusfunctions there's a chance performance will regress. On the other hand, when dealing with the file system what's usually slow is I/O and therefore the overhead of proxies might be negligible.