tschaub / mock-fs

Configurable mock for the fs module
https://npmjs.org/package/mock-fs
Other
906 stars 86 forks source link

Option to merge nested mock() in test suites #379

Open kien-ht opened 11 months ago

kien-ht commented 11 months ago

Describe the problem

In case my test suites were structured like this:

describe('suite', () => {
  beforeEach(() => {
    mock({
      'path-a': 'file content a'
    })
  })

  it('test', () => {
    mock({
      'path-b': 'file content b'
    })
    ...
  })
})

Expected result

My virtual file system should contain both path-a and path-b

Actual Result

Only path-b exists

Is there any way to make this work?