@@ -562,8 +562,11 @@ function _mustCallInner(fn) {
562562}
563563
564564exports . hasMultiLocalhost = function hasMultiLocalhost ( ) {
565- var TCP = process . binding ( 'tcp_wrap' ) . TCP ;
566- var t = new TCP ( ) ;
565+ var _process$binding = process . binding ( 'tcp_wrap' ) ,
566+ TCP = _process$binding . TCP ,
567+ TCPConstants = _process$binding . constants ;
568+
569+ var t = new TCP ( TCPConstants . SOCKET ) ;
567570 var ret = t . bind ( '127.0.0.2' , 0 ) ;
568571 t . close ( ) ;
569572 return ret === 0 ;
@@ -578,6 +581,12 @@ exports.fileExists = function (pathname) {
578581 }
579582} ;
580583
584+ exports . skipIfEslintMissing = function ( ) {
585+ if ( ! exports . fileExists ( path . join ( '..' , '..' , 'tools' , 'node_modules' , 'eslint' ) ) ) {
586+ exports . skip ( 'missing ESLint' ) ;
587+ }
588+ } ;
589+
581590exports . canCreateSymLink = function ( ) {
582591 // On Windows, creating symlinks requires admin privileges.
583592 // We'll only try to run symlink test if we have enough privileges.
@@ -769,7 +778,7 @@ exports.expectsError = function expectsError(fn, settings, exact) {
769778 settings = fn ;
770779 fn = undefined ;
771780 }
772- var innerFn = exports . mustCall ( function ( error ) {
781+ function innerFn ( error ) {
773782 assert . strictEqual ( error . code , settings . code ) ;
774783 if ( 'type' in settings ) {
775784 var type = settings . type ;
@@ -799,12 +808,12 @@ exports.expectsError = function expectsError(fn, settings, exact) {
799808 } ) ;
800809 }
801810 return true ;
802- } , exact ) ;
811+ }
803812 if ( fn ) {
804813 assert . throws ( fn , innerFn ) ;
805814 return ;
806815 }
807- return innerFn ;
816+ return exports . mustCall ( innerFn , exact ) ;
808817} ;
809818
810819exports . skipIfInspectorDisabled = function skipIfInspectorDisabled ( ) {
@@ -819,15 +828,16 @@ exports.skipIf32Bits = function skipIf32Bits() {
819828 }
820829} ;
821830
822- var arrayBufferViews = [ Int8Array , Uint8Array , Uint8ClampedArray , Int16Array , Uint16Array , Int32Array , Uint32Array , Float32Array , Float64Array , DataView ] ;
823-
824831exports . getArrayBufferViews = function getArrayBufferViews ( buf ) {
825832 var buffer = buf . buffer ,
826833 byteOffset = buf . byteOffset ,
827834 byteLength = buf . byteLength ;
828835
829836
830837 var out = [ ] ;
838+
839+ var arrayBufferViews = [ Int8Array , Uint8Array , Uint8ClampedArray , Int16Array , Uint16Array , Int32Array , Uint32Array , Float32Array , Float64Array , DataView ] ;
840+
831841 var _iteratorNormalCompletion = true ;
832842 var _didIteratorError = false ;
833843 var _iteratorError = undefined ;
@@ -909,35 +919,6 @@ function restoreWritable(name) {
909919 delete process [ name ] . writeTimes ;
910920}
911921
912- function onResolvedOrRejected ( promise , callback ) {
913- return promise . then ( function ( result ) {
914- callback ( ) ;
915- return result ;
916- } , function ( error ) {
917- callback ( ) ;
918- throw error ;
919- } ) ;
920- }
921-
922- function timeoutPromise ( error , timeoutMs ) {
923- var clearCallback = null ;
924- var done = false ;
925- var promise = onResolvedOrRejected ( new Promise ( function ( resolve , reject ) {
926- var timeout = setTimeout ( function ( ) {
927- return reject ( error ) ;
928- } , timeoutMs ) ;
929- clearCallback = function ( ) {
930- if ( done ) return ;
931- clearTimeout ( timeout ) ;
932- resolve ( ) ;
933- } ;
934- } ) , function ( ) {
935- return done = true ;
936- } ) ;
937- promise . clear = clearCallback ;
938- return promise ;
939- }
940-
941922exports . hijackStdout = hijackStdWritable . bind ( null , 'stdout' ) ;
942923exports . hijackStderr = hijackStdWritable . bind ( null , 'stderr' ) ;
943924exports . restoreStdout = restoreWritable . bind ( null , 'stdout' ) ;
@@ -952,19 +933,6 @@ exports.firstInvalidFD = function firstInvalidFD() {
952933 return fd ;
953934} ;
954935
955- exports . fires = function fires ( promise , error , timeoutMs ) {
956- if ( ! timeoutMs && util . isNumber ( error ) ) {
957- timeoutMs = error ;
958- error = null ;
959- }
960- if ( ! error ) error = 'timeout' ;
961- if ( ! timeoutMs ) timeoutMs = 100 ;
962- var timeout = timeoutPromise ( error , timeoutMs ) ;
963- return Promise . race ( [ onResolvedOrRejected ( promise , function ( ) {
964- return timeout . clear ( ) ;
965- } ) , timeout ] ) ;
966- } ;
967-
968936function forEach ( xs , f ) {
969937 for ( var i = 0 , l = xs . length ; i < l ; i ++ ) {
970938 f ( xs [ i ] , i ) ;
0 commit comments