fix: Merge manifest validation reports to include latest validation errors and warnings#3567
Conversation
| jest.mock('fs'); | ||
| jest.mock('../fs', () => ({ | ||
| ...jest.requireActual('../fs'), | ||
| useFileSystemCache: |
There was a problem hiding this comment.
This just disables the file system cache. We mock network requests anyway, and doing this makes testing a bit easier.
There was a problem hiding this comment.
What does this make easier?
There was a problem hiding this comment.
I couldn't figure out how to test the new invalid platform version warning showing up without changing this. It would always cache the correct version.
There was a problem hiding this comment.
Not sure I understand how this changes that, the mock returns the platform version from getPlatformVersion anyways 🤔
There was a problem hiding this comment.
The test replaces the fetch mock.
fetchMock.mockResponseOnce(MOCK_GITHUB_RESPONSE).mockResponseOnce(
JSON.stringify({
dependencies: {
'@metamask/snaps-sdk': '1.0.0',
},
}),
);
There was a problem hiding this comment.
Maybe try if clearing it out in resetFileSystem fixes it? Otherwise fine to merge as-is
There was a problem hiding this comment.
The cache seems to be written to the real file system, or at least I can't find where it is in the virtual file system 🤔
There was a problem hiding this comment.
I would expect something like this:
await fs.rm('./node_modules/.cache/snaps', { recursive: true, force: true });
Does that not work?
There was a problem hiding this comment.
It doesn't, I'm not seeing the node_modules/.cache folder anywhere in the VFS
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3567 +/- ##
=======================================
Coverage 98.28% 98.28%
=======================================
Files 417 417
Lines 11764 11769 +5
Branches 1829 1830 +1
=======================================
+ Hits 11562 11567 +5
Misses 202 202 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
This updates the manifest validation to merge new reports after the initial validation. We run the validation logic in a loop to address any newly found issues, but previously, newly found errors or warnings were never actually surfaced: Only the reports found in the initial validation were used.
After this change, each report has an ID based on the name of the report, and for validators with multiple potential errors (e.g., unused exports/endowments), a different ID is used as well. This ensures we can merge reports without duplicating them (causing two shasum warnings for example).
Closes #3505.