Skip to content

Not terminating all processes? #29

@azaslavsky

Description

@azaslavsky

I am trying to run drool via gulp-jasmine. A common problem experienced with gulp-jasmine is it not emiting the "end" event for its stream, as seen here: sindresorhus/gulp-jasmine#49. The basic answer given was that the tests being run in Jasmine are currently leaving processes unterminated, which prevents the 'end' event from being fired, since there are still active listeners. I am currently running the following test, based roughly on the example you provide in the docs. It seems like this exact issue is popping up for me:

var drool = require('drool');
var memUtils = require(process.cwd() + '/src/_test/utilsMem.js');
var config = {
  chromeOptions: 'no-sandbox',
};



describe('ngAvatar component: ', function() {
  var driver;

  beforeEach(function() {
    if (typeof process.env.chromeBinaryPath !== 'undefined') {
      config.chromeBinaryPath = process.env.chromeBinaryPath;
    }

    driver = drool.start(config);
  });

  afterEach(function() {
    driver.quit();
  });

  it('should not leak memory when added, then removed', function(done) {
    drool.flow({
      repeatCount: 10,
      setup: function() {
        return driver.get(memUtils.getTestFile())
          .then(function() {
            return driver.executeScript('myAppTest.start("ngAvatar");');
          })
          .catch(function(e) {
            console.log(e.toString().red);
          })
      },
      action: function() {
        var componentStr = '<ng-avatar img-src="./resources/twitter_prof_1.jpg"></ng-avatar>';
        return driver.executeScript('window.testingScope = myAppTest.insert("#root", \'' + componentStr + '\');')
          .then(function() {
            return driver.executeScript('myAppTest.destroy(window.testingScope);');
          })
          .then(function() {
            return driver.executeScript('myAppTest.reset("#root");');
          })
          .catch(function(e) {
            console.log(e.toString().red);
          })
      },
      beforeAssert: function() {
        return driver.executeScript('myAppTest.digest();')
          .then(function() {
            return driver.sleep(4000);
          })
          .catch(function(e) {
            console.log(e.toString().red);
          })
      },
      assert: function(after, initial) {
        memUtils.log(after, initial);

        expect(after.counts.nodes).not.toBeGreaterThan(initial.counts.nodes);
        expect(after.counts.jsEventListeners).not.toBeGreaterThan(initial.counts.jsEventListeners);
      },
      exit: function() {
        done();
      }
    }, driver);
  });
});

Any thoughts on what the unterminated process could be?

Ps: some more details from the gulp side of things, if it helps: http://stackoverflow.com/questions/37756443/gulp-task-exits-before-stream-can-fire-an-end-event/37756998?noredirect=1#comment62983737_37756998

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions