-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Confirm that mock-fs works if another file requires fs-extra first
- Loading branch information
Showing
4 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* This test is here so that fs-extra is required before mock-fs in the | ||
* B.spec.js file. | ||
* | ||
* See https://github.com/tschaub/mock-fs/issues/103 | ||
*/ | ||
|
||
var assert = require('../helper').assert; | ||
var fs = require('fs-extra'); | ||
|
||
describe('Dummy test A', function() { | ||
it('should pass', function() { | ||
assert.equal(typeof fs, 'object'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* The A.spec.js file requires fs-extra before this one. Here we confirm that | ||
* mock-fs still works even if fs-extra was required elsewhere first. | ||
* | ||
* See https://github.com/tschaub/mock-fs/issues/103 | ||
*/ | ||
|
||
var assert = require('../helper').assert; | ||
var mock = require('../../lib/index'); | ||
var fs = require('fs-extra'); | ||
|
||
describe('Dummy test B', function() { | ||
before(function() { | ||
mock({ | ||
folder: {} | ||
}); | ||
}); | ||
|
||
after(function() { | ||
mock.restore(); | ||
}); | ||
|
||
it('should read mocked directory', function() { | ||
var content = fs.readdirSync('folder'); | ||
assert.isArray(content); | ||
}); | ||
|
||
}); |