@@ -62,20 +62,22 @@ if (process.platform !== 'win32') {
62
62
tmpNonMatchingDtJsonPartitionPath ,
63
63
12 ,
64
64
async ( _fs ) => {
65
- const readFileAsync = promisify ( _fs . readFile ) ;
66
- const writeFileAsync = promisify ( _fs . writeFile ) ;
67
-
68
65
const dtJson = JSON . parse (
69
- await readFileAsync ( '/device-type.json' , { encoding : 'utf8' } ) ,
66
+ await _fs . promises . readFile ( '/device-type.json' , {
67
+ encoding : 'utf8' ,
68
+ } ) ,
70
69
) ;
71
70
expect ( dtJson ) . to . have . nested . property (
72
71
'configuration.config.partition' ,
73
72
12 ,
74
73
) ;
75
74
dtJson . configuration . config . partition = 999 ;
76
- await writeFileAsync ( '/device-type.json' , JSON . stringify ( dtJson ) ) ;
75
+ await _fs . promises . writeFile (
76
+ '/device-type.json' ,
77
+ JSON . stringify ( dtJson ) ,
78
+ ) ;
77
79
78
- await writeFileAsync (
80
+ await _fs . promises . writeFile (
79
81
'/os-release' ,
80
82
stripIndent `
81
83
ID="balena-os"
@@ -133,16 +135,17 @@ if (process.platform !== 'win32') {
133
135
tmpMatchingDtJsonPartitionPath ,
134
136
12 ,
135
137
async ( _fs ) => {
136
- const readFileAsync = promisify ( _fs . readFile ) ;
137
138
const dtJson = JSON . parse (
138
- await readFileAsync ( '/device-type.json' , { encoding : 'utf8' } ) ,
139
+ await _fs . promises . readFile ( '/device-type.json' , {
140
+ encoding : 'utf8' ,
141
+ } ) ,
139
142
) ;
140
143
// confirm that the device-type.json mentions the expected partition
141
144
expect ( dtJson ) . to . have . nested . property (
142
145
'configuration.config.partition' ,
143
146
12 ,
144
147
) ;
145
- return await readFileAsync ( '/config.json' ) ;
148
+ return await _fs . promises . readFile ( '/config.json' ) ;
146
149
} ,
147
150
) ;
148
151
expect ( config ) . to . not . be . empty ;
@@ -180,16 +183,17 @@ if (process.platform !== 'win32') {
180
183
tmpNonMatchingDtJsonPartitionPath ,
181
184
12 ,
182
185
async ( _fs ) => {
183
- const readFileAsync = promisify ( _fs . readFile ) ;
184
186
const dtJson = JSON . parse (
185
- await readFileAsync ( '/device-type.json' , { encoding : 'utf8' } ) ,
187
+ await _fs . promises . readFile ( '/device-type.json' , {
188
+ encoding : 'utf8' ,
189
+ } ) ,
186
190
) ;
187
191
// confirm that the device-type.json mentions the expected partition
188
192
expect ( dtJson ) . to . have . nested . property (
189
193
'configuration.config.partition' ,
190
194
999 ,
191
195
) ;
192
- return await readFileAsync ( '/config.json' ) ;
196
+ return await _fs . promises . readFile ( '/config.json' ) ;
193
197
} ,
194
198
) ;
195
199
expect ( config ) . to . not . be . empty ;
@@ -240,7 +244,7 @@ if (process.platform !== 'win32') {
240
244
241
245
// confirm the image contains a config.json...
242
246
const config = await imagefs . interact ( tmpDummyPath , 1 , async ( _fs ) => {
243
- return await promisify ( _fs . readFile ) ( '/config.json' ) ;
247
+ return await _fs . promises . readFile ( '/config.json' ) ;
244
248
} ) ;
245
249
expect ( config ) . to . not . be . empty ;
246
250
0 commit comments