Sha256: 61fb737d398a996106a99475ef2620b6ae7cf7a1c81a3bedd32c9f7b142e59a0

Contents?: true

Size: 806 Bytes

Versions: 21

Compression:

Stored size: 806 Bytes

Contents

var test = require('tape'),
walk  = require('../walkdir.js');

test('should be able to pause walk',function(t){

  var paths = [];
  var paused = false;
  var em = walk('./',function(path){
    if(!paused){
      em.pause();
      paused = 1;
      setTimeout(function(){
        t.equals(paths.length,1,'while paused should not emit any more paths');
        em.resume();
      },300);
    } else if(paused == 1){
      em.pause();
      paused = 2;
      setTimeout(function(){
        t.equals(paths.length,2,'while paused should not emit any more paths');
        em.resume();
      },300);
    }

    paths.push(path);

  });

  em.on('end',function(){
    console.log('end, and i found ',paths.length,'paths');
    t.ok(paths.length > 1,'should have more paths before end');
    t.end();
  });

});

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
ela-4.1.6 node_modules/walkdir/test/pauseresume.js
ela-4.1.5 node_modules/walkdir/test/pauseresume.js
ela-4.1.4 node_modules/walkdir/test/pauseresume.js
ela-4.1.3 node_modules/walkdir/test/pauseresume.js
ela-4.1.2 node_modules/walkdir/test/pauseresume.js
ela-4.1.1 node_modules/walkdir/test/pauseresume.js
ela-4.1.0 node_modules/walkdir/test/pauseresume.js
ela-4.0.0 node_modules/walkdir/test/pauseresume.js
ela-3.4.3 node_modules/walkdir/test/pauseresume.js
ela-3.4.2 node_modules/walkdir/test/pauseresume.js
ela-3.4.0 node_modules/walkdir/test/pauseresume.js
ela-3.3.1 node_modules/walkdir/test/pauseresume.js
ela-3.3.0 node_modules/walkdir/test/pauseresume.js
ela-3.2.0 node_modules/walkdir/test/pauseresume.js
ela-3.1.1 node_modules/walkdir/test/pauseresume.js
ela-3.1.0 node_modules/walkdir/test/pauseresume.js
ela-3.0.0 node_modules/walkdir/test/pauseresume.js
ela-2.0.0 node_modules/walkdir/test/pauseresume.js
ela-1.1.0 node_modules/walkdir/test/pauseresume.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/walkdir/test/pauseresume.js