@@ -7,6 +7,7 @@ const fs = require('graceful-fs')
77const  os  =  require ( 'os' ) 
88const  cp  =  require ( 'child_process' ) 
99const  util  =  require ( '../lib/util' ) 
10+ const  {  platformTimeout }  =  require ( './common' ) 
1011
1112const  addonPath  =  path . resolve ( __dirname ,  'node_modules' ,  'hello_world' ) 
1213const  nodeGyp  =  path . resolve ( __dirname ,  '..' ,  'bin' ,  'node-gyp.js' ) 
@@ -41,9 +42,9 @@ function checkCharmapValid () {
4142} 
4243
4344describe ( 'addon' ,  function  ( )  { 
44-   this . timeout ( 300000 ) 
45- 
4645  it ( 'build simple addon' ,  async  function  ( )  { 
46+     this . timeout ( platformTimeout ( 1 ,  {  win32 : 5  } ) ) 
47+ 
4748    // Set the loglevel otherwise the output disappears when run via 'npm test' 
4849    const  cmd  =  [ nodeGyp ,  'rebuild' ,  '-C' ,  addonPath ,  '--loglevel=verbose' ] 
4950    const  [ err ,  logLines ]  =  await  execFile ( cmd ) 
@@ -69,15 +70,14 @@ describe('addon', function () {
6970      return  this . skip ( 'no need to test' ) 
7071    } 
7172
72-     this . timeout ( 300000 ) 
73+     this . timeout ( platformTimeout ( 1 ,   {   win32 :  5   } ) ) 
7374
7475    let  data 
7576    const  configPath  =  path . join ( addonPath ,  'build' ,  'config.gypi' ) 
7677    try  { 
7778      data  =  fs . readFileSync ( configPath ,  'utf8' ) 
7879    }  catch  ( err )  { 
79-       assert . fail ( err ) 
80-       return 
80+       return  assert . fail ( err ) 
8181    } 
8282    const  config  =  JSON . parse ( data . replace ( / # .+ \n / ,  '' ) ) 
8383    const  nodeDir  =  config . variables . nodedir 
@@ -89,11 +89,9 @@ describe('addon', function () {
8989      switch  ( err . code )  { 
9090        case  'EEXIST' : break 
9191        case  'EPERM' :
92-           assert . fail ( err ,  null ,  'Please try to running console as an administrator' ) 
93-           return 
92+           return  assert . fail ( err ,  null ,  'Please try to running console as an administrator' ) 
9493        default :
95-           assert . fail ( err ) 
96-           return 
94+           return  assert . fail ( err ) 
9795      } 
9896    } 
9997
@@ -118,7 +116,7 @@ describe('addon', function () {
118116  } ) 
119117
120118  it ( 'addon works with renamed host executable' ,  async  function  ( )  { 
121-     this . timeout ( 300000 ) 
119+     this . timeout ( platformTimeout ( 1 ,   {   win32 :  5   } ) ) 
122120
123121    const  notNodePath  =  path . join ( os . tmpdir ( ) ,  'notnode'  +  path . extname ( process . execPath ) ) 
124122    fs . copyFileSync ( process . execPath ,  notNodePath ) 
0 commit comments