-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
scaffolder-backend: refactor tests to avoid mock-fs #20404
Merged
Merged
Conversation
This file contains 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
Rugvip
requested review from
freben and
vinzscam
and removed request for
a team
October 5, 2023 20:05
github-actions
bot
added
the
area:scaffolder
Everything and all things related to the scaffolder project area
label
Oct 5, 2023
Uffizzi Preview |
Rugvip
force-pushed
the
rugvip/more-20-fixes
branch
from
October 6, 2023 07:35
45b9ff7
to
fef854a
Compare
Rugvip
force-pushed
the
rugvip/scaffodler-no-mockfs
branch
from
October 6, 2023 10:47
c3f257e
to
7d077ae
Compare
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
…k-fs Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
… modes Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
…ock-fs Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
…ck-fs Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Rugvip
force-pushed
the
rugvip/scaffodler-no-mockfs
branch
from
October 6, 2023 11:31
7d077ae
to
94e3cb2
Compare
Missing ChangesetsThe following package(s) are changed by this PR but do not have a changeset:
See CONTRIBUTING.md for more information about how to add changesets. Changed Packages
|
vinzscam
approved these changes
Oct 6, 2023
taliesins
added a commit
to taliesins/backstage-showcase
that referenced
this pull request
Mar 27, 2024
…the unit tests. Mock-fs was failing to read and test for mocked files.
taliesins
added a commit
to taliesins/backstage-showcase
that referenced
this pull request
Mar 27, 2024
…the unit tests. Mock-fs was failing to read and test for mocked files.
taliesins
added a commit
to taliesins/backstage-showcase
that referenced
this pull request
Mar 27, 2024
…the unit tests. Mock-fs was failing to read and test for mocked files.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
After #20399 these should be the last fixes needed for us to be able to run test towards Node.js 20 again. There's still 24 more tests that use mock-fs, thinking we'll leave those for contributions as they're less urgent and it'd be good to get some more feedback on the
MockDirectory
API.This PR introduces two more changes to the
MockDirectory
API. It reverts to using default file modes, since explicit modes should be unnecessary.It also adds a new callback format for writing content to the mock dir, used for more specific file system operations than just "a file" or "a directory". It's in the form of a callback that will be called once the directory content serialization has gotten to the point of that item. The parent directory will always exist, and the target path is provided as part of the callback context, which makes it simple to execute arbitrary synchronous filesystem operations at that location. There is also a
symlink(target)
helper that creates a symlink at the location. This is a bit different than the graph-based approach that mock-fs uses, but feels like it provides a lot more power with a slimmer API surface, with the drawback being that it's a much more specific and synchronous API.