-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
fix(content-docs): suppress git error on multiple occurrences #6973
Conversation
I created the |
e44c80d
to
4664856
Compare
@@ -69,7 +69,12 @@ describe('getFileLastUpdate', () => { | |||
const consoleMock = jest | |||
.spyOn(console, 'warn') | |||
.mockImplementation(() => {}); | |||
const tempFilePath = path.join(__dirname, '__fixtures__', '.temp'); | |||
const tempFilePath = path.join( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can reference the implementation in #6949 and use the system's temp folder instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it errors with:
not a git repository (or any of the parent directories): .git
In your case that was ok, since you needed to create a temp git repo dir, but I think here it's not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creating a git repo isn't the most expensive thing we've done in our tests, so I think it's okay, compared to repeatedly writing files within our own repo. We used to do the same thing for the migration test, but that one was later refactored to use FS mocks instead.
In the near future, we would provide a unified tester interface so all git-related tests will be done within the same temp git repo, but for now, I'm okay with initializing another git repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Josh-Cena Right, understood. I need the
function createTempRepo() { |
Function then. Any suggestion on how I can export it? I mean, I could simply "export" it and add:
// eslint-disable-next-line jest/no-export
To it. But, should I?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that seems a bit intractable. I'd rather not disable the rule, since you have to import it cross-module anyways. Can you lift this util to the jest
folder and add a module name mapper like "@testing-utils/*": "<rootDir>/jest/utils"
? We will eventually publish a separate package for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it, just to show, but I can revert.
In the near future, we would provide a unified tester interface so all git-related tests will be done within the same temp git repo
Perhaps we should leave as is until then? If you prefer I can even revert my .gitignore addition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you lift this util to the jest folder and add a module name mapper like "@testing-utils/*": "/jest/utils"? We will eventually publish a separate package for that.
Nice. I will take a look.
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-6973--docusaurus-2.netlify.app/ |
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, exactly what I wanted 👍
Thanks, that looks nice ;) |
Motivation
#6937 (comment)
Have you read the Contributing Guidelines on pull requests?
Test Plan
I wrote tests.
Related PRs
#6937
cardano-foundation/developer-portal#557