@@ -8,6 +8,8 @@ const assert = require('assert')
8
8
9
9
/* global afterEach, beforeEach, describe, it */
10
10
11
+ const describeIfWindows = process . platform === 'win32' ? describe : describe . skip
12
+
11
13
function createAsyncErrFn ( errCode ) {
12
14
const fn = function ( ...args ) {
13
15
fn . callCount ++
@@ -63,7 +65,7 @@ describe('+ move()', () => {
63
65
fs . readFile ( dest , 'utf8' , ( err , contents ) => {
64
66
const expected = / ^ s o n i c t h e h e d g e h o g \r ? \n $ /
65
67
assert . ifError ( err )
66
- assert . ok ( contents . match ( expected ) , ` ${ contents } match ${ expected } ` )
68
+ assert . ok ( contents . match ( expected ) )
67
69
done ( )
68
70
} )
69
71
} )
@@ -114,7 +116,7 @@ describe('+ move()', () => {
114
116
fs . readFile ( path . join ( dest , 'another-folder' , 'file3' ) , 'utf8' , ( err , contents ) => {
115
117
const expected = / ^ k n u c k l e s \r ? \n $ /
116
118
assert . ifError ( err )
117
- assert . ok ( contents . match ( expected ) , ` ${ contents } match ${ expected } ` )
119
+ assert . ok ( contents . match ( expected ) )
118
120
tearDownMockFs ( )
119
121
done ( )
120
122
} )
@@ -132,7 +134,7 @@ describe('+ move()', () => {
132
134
fs . readFile ( dest , 'utf8' , ( err , contents ) => {
133
135
const expected = / ^ s o n i c t h e h e d g e h o g \r ? \n $ /
134
136
assert . ifError ( err )
135
- assert . ok ( contents . match ( expected ) , ` ${ contents } match ${ expected } ` )
137
+ assert . ok ( contents . match ( expected ) )
136
138
done ( )
137
139
} )
138
140
} )
@@ -206,7 +208,7 @@ describe('+ move()', () => {
206
208
fs . readFile ( dest , 'utf8' , ( err , contents ) => {
207
209
const expected = / ^ s o n i c t h e h e d g e h o g \r ? \n $ /
208
210
assert . ifError ( err )
209
- assert . ok ( contents . match ( expected ) , ` ${ contents } match ${ expected } ` )
211
+ assert . ok ( contents . match ( expected ) )
210
212
done ( )
211
213
} )
212
214
} )
@@ -225,7 +227,7 @@ describe('+ move()', () => {
225
227
fs . readFile ( dest , 'utf8' , ( err , contents ) => {
226
228
const expected = / ^ s o n i c t h e h e d g e h o g \r ? \n $ /
227
229
assert . ifError ( err )
228
- assert . ok ( contents . match ( expected ) , ` ${ contents } match ${ expected } ` )
230
+ assert . ok ( contents . match ( expected ) )
229
231
tearDownMockFs ( )
230
232
done ( )
231
233
} )
@@ -244,7 +246,7 @@ describe('+ move()', () => {
244
246
fs . readFile ( path . join ( dest , 'another-file' ) , 'utf8' , ( err , contents ) => {
245
247
const expected = / ^ t a i l s \r ? \n $ /
246
248
assert . ifError ( err )
247
- assert . ok ( contents . match ( expected ) , ` ${ contents } match ${ expected } ` )
249
+ assert . ok ( contents . match ( expected ) )
248
250
done ( )
249
251
} )
250
252
} )
@@ -263,14 +265,35 @@ describe('+ move()', () => {
263
265
fs . readFile ( path . join ( dest , 'another-folder' , 'file3' ) , 'utf8' , ( err , contents ) => {
264
266
const expected = / ^ k n u c k l e s \r ? \n $ /
265
267
assert . ifError ( err )
266
- assert . ok ( contents . match ( expected ) , ` ${ contents } match ${ expected } ` )
268
+ assert . ok ( contents . match ( expected ) )
267
269
tearDownMockFs ( )
268
270
done ( )
269
271
} )
270
272
} )
271
273
} )
272
274
} )
273
275
276
+ describeIfWindows ( '> when dest parent is root' , ( ) => {
277
+ let dest
278
+
279
+ afterEach ( done => fse . remove ( dest , done ) )
280
+
281
+ it ( 'should not create parent directory' , done => {
282
+ const src = path . join ( TEST_DIR , 'a-file' )
283
+ dest = path . join ( path . parse ( TEST_DIR ) . root , 'another-file' )
284
+
285
+ fse . move ( src , dest , err => {
286
+ assert . ifError ( err )
287
+ fs . readFile ( dest , 'utf8' , ( err , contents ) => {
288
+ const expected = / ^ s o n i c t h e h e d g e h o g \r ? \n $ /
289
+ assert . ifError ( err )
290
+ assert . ok ( contents . match ( expected ) )
291
+ done ( )
292
+ } )
293
+ } )
294
+ } )
295
+ } )
296
+
274
297
describe ( '> clobber' , ( ) => {
275
298
it ( 'should be an alias for overwrite' , done => {
276
299
const src = path . join ( TEST_DIR , 'a-file' )
@@ -284,7 +307,7 @@ describe('+ move()', () => {
284
307
fs . readFile ( dest , 'utf8' , ( err , contents ) => {
285
308
const expected = / ^ s o n i c t h e h e d g e h o g \r ? \n $ /
286
309
assert . ifError ( err )
287
- assert . ok ( contents . match ( expected ) , ` ${ contents } match ${ expected } ` )
310
+ assert . ok ( contents . match ( expected ) )
288
311
done ( )
289
312
} )
290
313
} )
0 commit comments