Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not terminating all processes? #29

Open
azaslavsky opened this issue Jun 11, 2016 · 0 comments
Open

Not terminating all processes? #29

azaslavsky opened this issue Jun 11, 2016 · 0 comments

Comments

@azaslavsky
Copy link

azaslavsky commented Jun 11, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant