File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
+ // Flags: --expose-internals
2
3
const common = require ( '../common' ) ;
3
4
const assert = require ( 'assert' ) ;
4
5
const fs = require ( 'fs' ) ;
5
6
const vm = require ( 'vm' ) ;
6
7
const { promisify } = require ( 'util' ) ;
8
+ const { customPromisifyArgs } = require ( 'internal/util' ) ;
7
9
8
10
common . crashOnUnhandledRejection ( ) ;
9
11
@@ -42,6 +44,21 @@ const stat = promisify(fs.stat);
42
44
'be a function' ) ;
43
45
}
44
46
47
+ {
48
+ const firstValue = 5 ;
49
+ const secondValue = 17 ;
50
+
51
+ function fn ( callback ) {
52
+ callback ( null , firstValue , secondValue ) ;
53
+ }
54
+
55
+ fn [ customPromisifyArgs ] = [ 'first' , 'second' ] ;
56
+
57
+ promisify ( fn ) ( ) . then ( common . mustCall ( ( obj ) => {
58
+ assert . deepStrictEqual ( obj , { first : firstValue , second : secondValue } ) ;
59
+ } ) ) ;
60
+ }
61
+
45
62
{
46
63
const fn = vm . runInNewContext ( '(function() {})' ) ;
47
64
assert . notStrictEqual ( Object . getPrototypeOf ( promisify ( fn ) ) ,
You can’t perform that action at this time.
0 commit comments