@@ -292,6 +292,66 @@ describe('options', function () {
292
292
} ) ;
293
293
} ) ;
294
294
295
+ xdescribe ( 'bidi' , function ( ) {
296
+ const treeBefore = {
297
+ srcDir : tree . c ,
298
+ targetDir : tree . d ,
299
+ } ;
300
+ const treeAfter = {
301
+ srcDir : { ...tree . c , ...tree . d } ,
302
+ targetDir : { ...tree . d , ...tree . c } ,
303
+ } ;
304
+
305
+ beforeEach ( function ( ) {
306
+ mkDirTree ( testDir , treeBefore ) ;
307
+ assertDirTree ( testDir , treeBefore ) ;
308
+ } ) ;
309
+
310
+ afterEach ( function ( ) {
311
+ fs . rmSync ( testDir , { recursive : true , force : true } ) ;
312
+ } ) ;
313
+
314
+ describe ( 'sync' , function ( ) {
315
+ const t = syncDirectory => async function ( ) {
316
+ await syncDirectory ( srcDir , targetDir , {
317
+ type : 'copy' ,
318
+ bidi : true ,
319
+ } ) ;
320
+ assertDirTree ( testDir , treeAfter ) ;
321
+ } ;
322
+
323
+ it ( 'copy forward & backward (sync)' , t ( syncDirectory . sync ) ) ;
324
+ it ( 'copy forward & backward (async)' , t ( syncDirectory . async ) ) ;
325
+ } ) ;
326
+
327
+ describe ( 'watch' , function ( ) {
328
+ const t = syncDirectory => async function ( ) {
329
+ let watcher ;
330
+ try {
331
+ watcher = await syncDirectory ( srcDir , targetDir , {
332
+ type : 'copy' ,
333
+ watch : true ,
334
+ bidi : true ,
335
+ } ) ;
336
+ assertDirTree ( testDir , treeAfter ) ;
337
+ await setTimeout ( 100 ) ;
338
+ fs . writeFileSync ( srcFile , 'new data' ) ;
339
+ await setTimeout ( 100 ) ;
340
+ assertFileContent ( targetFile , 'new data' ) ;
341
+ fs . writeFileSync ( targetFile , 'test data' ) ;
342
+ await setTimeout ( 100 ) ;
343
+ assertFileContent ( srcFile , 'test data' ) ;
344
+ assertDirTree ( testDir , treeAfter ) ;
345
+ } finally {
346
+ await watcher . close ( ) ;
347
+ } ;
348
+ } ;
349
+
350
+ it ( 'copy & watch forward & backward (sync)' , t ( syncDirectory . sync ) ) ;
351
+ it ( 'copy & watch forward & backward (async)' , t ( syncDirectory . async ) ) ;
352
+ } ) ;
353
+ } ) ;
354
+
295
355
describe ( 'deleteOrphaned' , function ( ) {
296
356
const treeBefore = {
297
357
srcDir : tree . a ,
0 commit comments