File tree 3 files changed +6
-26
lines changed
3 files changed +6
-26
lines changed Original file line number Diff line number Diff line change 3
3
/* eslint-env mocha */
4
4
5
5
const assert = require ( 'assert' )
6
- const fs = require ( 'fs' )
7
6
const fse = require ( '..' )
8
7
9
8
const methods = [
@@ -24,11 +23,8 @@ describe('promise support', () => {
24
23
} )
25
24
} )
26
25
27
- if ( Object . getOwnPropertyDescriptor ( fs , 'promises' ) ) {
28
- it ( 'provides fse.promises API' , ( ) => {
29
- const desc = Object . getOwnPropertyDescriptor ( fse , 'promises' )
30
- assert . ok ( desc )
31
- assert . strictEqual ( typeof desc . get , 'function' )
32
- } )
33
- }
26
+ it ( 'provides fse.promises API' , ( ) => {
27
+ assert . ok ( fse . promises )
28
+ assert . strictEqual ( typeof fse . promises . writeFile , 'function' )
29
+ } )
34
30
} )
Original file line number Diff line number Diff line change @@ -47,15 +47,8 @@ const api = [
47
47
return typeof fs [ key ] === 'function'
48
48
} )
49
49
50
- // Export all keys:
51
- Object . keys ( fs ) . forEach ( key => {
52
- if ( key === 'promises' ) {
53
- // fs.promises is a getter property that triggers ExperimentalWarning
54
- // Don't re-export it here, the getter is defined in "lib/index.js"
55
- return
56
- }
57
- exports [ key ] = fs [ key ]
58
- } )
50
+ // Export cloned fs:
51
+ Object . assign ( exports , fs )
59
52
60
53
// Universalify async methods:
61
54
api . forEach ( method => {
Original file line number Diff line number Diff line change @@ -16,12 +16,3 @@ module.exports = {
16
16
...require ( './path-exists' ) ,
17
17
...require ( './remove' )
18
18
}
19
-
20
- // Export fs.promises as a getter property so that we don't trigger
21
- // ExperimentalWarning before fs.promises is actually accessed.
22
- const fs = require ( 'fs' )
23
- if ( Object . getOwnPropertyDescriptor ( fs , 'promises' ) ) {
24
- Object . defineProperty ( module . exports , 'promises' , {
25
- get ( ) { return fs . promises }
26
- } )
27
- }
You can’t perform that action at this time.
0 commit comments