@@ -7,6 +7,7 @@ const fs = require('graceful-fs')
7
7
const os = require ( 'os' )
8
8
const cp = require ( 'child_process' )
9
9
const util = require ( '../lib/util' )
10
+ const { platformTimeout } = require ( './common' )
10
11
11
12
const addonPath = path . resolve ( __dirname , 'node_modules' , 'hello_world' )
12
13
const nodeGyp = path . resolve ( __dirname , '..' , 'bin' , 'node-gyp.js' )
@@ -41,9 +42,9 @@ function checkCharmapValid () {
41
42
}
42
43
43
44
describe ( 'addon' , function ( ) {
44
- this . timeout ( 300000 )
45
-
46
45
it ( 'build simple addon' , async function ( ) {
46
+ this . timeout ( platformTimeout ( 1 , { win32 : 5 } ) )
47
+
47
48
// Set the loglevel otherwise the output disappears when run via 'npm test'
48
49
const cmd = [ nodeGyp , 'rebuild' , '-C' , addonPath , '--loglevel=verbose' ]
49
50
const [ err , logLines ] = await execFile ( cmd )
@@ -69,15 +70,14 @@ describe('addon', function () {
69
70
return this . skip ( 'no need to test' )
70
71
}
71
72
72
- this . timeout ( 300000 )
73
+ this . timeout ( platformTimeout ( 1 , { win32 : 5 } ) )
73
74
74
75
let data
75
76
const configPath = path . join ( addonPath , 'build' , 'config.gypi' )
76
77
try {
77
78
data = fs . readFileSync ( configPath , 'utf8' )
78
79
} catch ( err ) {
79
- assert . fail ( err )
80
- return
80
+ return assert . fail ( err )
81
81
}
82
82
const config = JSON . parse ( data . replace ( / # .+ \n / , '' ) )
83
83
const nodeDir = config . variables . nodedir
@@ -89,11 +89,9 @@ describe('addon', function () {
89
89
switch ( err . code ) {
90
90
case 'EEXIST' : break
91
91
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' )
94
93
default :
95
- assert . fail ( err )
96
- return
94
+ return assert . fail ( err )
97
95
}
98
96
}
99
97
@@ -118,7 +116,7 @@ describe('addon', function () {
118
116
} )
119
117
120
118
it ( 'addon works with renamed host executable' , async function ( ) {
121
- this . timeout ( 300000 )
119
+ this . timeout ( platformTimeout ( 1 , { win32 : 5 } ) )
122
120
123
121
const notNodePath = path . join ( os . tmpdir ( ) , 'notnode' + path . extname ( process . execPath ) )
124
122
fs . copyFileSync ( process . execPath , notNodePath )
0 commit comments