Visual Studio Code Extension for Zowe, which lets users interact with z/OS Data Sets, Unix System Services, and Jobs on a remote mainframe instance. Powered by Zowe SDKs.
Eclipse Public License 2.0
170
stars
92
forks
source link
Use `memfs` to test filesystem operations in unit tests #2213
Recently we had an issue (fixed in #2188) where we were writing new contents to a JSON file that were shorter than the old contents without truncating the file, which resulted in invalid JSON.
With our current unit tests that mock fs methods using Jest, we don't have a way to detect this kind of bug. If we added tests that use the memfs package to mock out the file system in memory, we could.
Places where these kinds of tests could be useful:
Thank you for raising this issue.
The community has 90 days to upvote 👍 the issue.
If it receives 10 upvotes, we will move it to our backlog. If not, we will close it.
Recently we had an issue (fixed in #2188) where we were writing new contents to a JSON file that were shorter than the old contents without truncating the file, which resulted in invalid JSON.
With our current unit tests that mock
fs
methods using Jest, we don't have a way to detect this kind of bug. If we added tests that use thememfs
package to mock out the file system in memory, we could.Places where these kinds of tests could be useful:
fs.writeFileSync
: https://github.com/zowe/vscode-extension-for-zowe/blob/15fc59a54a57b7e5012e6c5a56af5f6fd529b160/packages/zowe-explorer/src/utils/ProfilesUtils.ts#L365Resources