From 7853a176184245d5938e0354bbc27567f9bfcc86 Mon Sep 17 00:00:00 2001 From: Paul Valla Date: Fri, 4 Jul 2014 00:53:32 +1000 Subject: [PATCH] Change test order due to a strange behaviour of memwatch --- test/testrunner.js | 4 +- test/units/leaks.js | 89 ++++++++++++++++++++++----------------------- 2 files changed, 46 insertions(+), 47 deletions(-) diff --git a/test/testrunner.js b/test/testrunner.js index 2be23e8..561fee4 100644 --- a/test/testrunner.js +++ b/test/testrunner.js @@ -14,11 +14,11 @@ testrunner.run([ { code: path + '/lib/crawler.js', tests: [ + path + '/test/units/leaks.js', path + '/test/units/simple.js', path + '/test/units/links.js', path + '/test/units/forceutf8.js', - path + '/test/units/errors.js', - path + '/test/units/leaks.js' + path + '/test/units/errors.js' ] } ],function(err, report) { diff --git a/test/units/leaks.js b/test/units/leaks.js index f1ba806..e41c6b3 100644 --- a/test/units/leaks.js +++ b/test/units/leaks.js @@ -3,7 +3,7 @@ var _ = require('underscore'); var memwatch = require('memwatch'); -QUnit.module('links'); +QUnit.module('leaks'); var DEBUG = false; var MOCKPORT = 30045; @@ -23,22 +23,21 @@ test('Check that we do leak w/ 100 jsdom requests without autoWindowClose', func retryTimeout: 1000, retries: 1, onDrain: function() { - hd = new memwatch.HeapDiff(); -// // Wait a bit for the GC to kick in -// setTimeout(function() { + // Wait a bit for the GC to kick in + setTimeout(function() { start(); -// var diff = hd.end(); - console.log('Bytes added to memory',diff.change.size_bytes); -// -// Should have grown by more than 50 MB. -// ok(diff.change.size_bytes > 50000000); -// }, 10000); + var diff = hd.end(); + console.log('Bytes added to memory', diff.change.size_bytes); + + //Should have grown by more than 50 MB. + ok(diff.change.size_bytes > 50000000); + }, 10000); } }); + hd = new memwatch.HeapDiff(); - - console.log('Queueing '+N+' requests w/ jsdom and autoWindowClose=false...'); + console.log('Queueing '+ N +' requests w/ jsdom and autoWindowClose=false...'); for (var i=0; i