You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before I say anything else, let me say thank you for a job well done! mock-fs is awesome, it's easy to use and makes testing file-system related stuff much less painless and faster than dealing with the real thing.
To make it even more painless and easy to use: It would be very nice if there was some way to populate the mocked file system incrementally. This would allow to set up some common files in before and beforeEach, then add test-specific stuff within the actual test. Like this:
beforeEach(function() {
// Pre-populate the file-system with some data that is common to all following tests:
mockfs({
foo: {
bar: 'baz'
}
})
});
it('should do complicated things correctly', function() {
mockfs({
'foo/qux': 'quux'
});
expect(complicated_things()).to.be.true;
});
it('should fail if qux is empty', function() {
mockfs({
'foo/qux': ''
});
expect(complicated_things()).to.be.false;
});
The text was updated successfully, but these errors were encountered:
True. The other way would still seem like a cleaner API to me, but I can see how this would probably not be a high-priority thing to implement. Thanks for the quick reply.
Probably add additional api like mockfs.merge or mockfs.patch.
We don't want the existing api surprises user if user forgot to call restore between two mockfs calls.
Before I say anything else, let me say thank you for a job well done! mock-fs is awesome, it's easy to use and makes testing file-system related stuff much less painless and faster than dealing with the real thing.
To make it even more painless and easy to use: It would be very nice if there was some way to populate the mocked file system incrementally. This would allow to set up some common files in
before
andbeforeEach
, then add test-specific stuff within the actual test. Like this:The text was updated successfully, but these errors were encountered: