File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
2+ // Flags: --expose-internals
23const common = require ( '../common' ) ;
34const assert = require ( 'assert' ) ;
45const fs = require ( 'fs' ) ;
56const vm = require ( 'vm' ) ;
67const { promisify } = require ( 'util' ) ;
8+ const { customPromisifyArgs } = require ( 'internal/util' ) ;
79
810common . crashOnUnhandledRejection ( ) ;
911
@@ -42,6 +44,21 @@ const stat = promisify(fs.stat);
4244 'be a function' ) ;
4345}
4446
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+
4562{
4663 const fn = vm . runInNewContext ( '(function() {})' ) ;
4764 assert . notStrictEqual ( Object . getPrototypeOf ( promisify ( fn ) ) ,
You can’t perform that action at this time.
0 commit comments