Skip to content

Commit

Permalink
fix possible memory issue with pending tests (#95) (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgruber authored Nov 20, 2016
1 parent f1b7531 commit 1a2aa7d
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 111 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#Changelog

###1.5.4
- Run pending tests thru `cleanTest` function. Fixes possible scenario where a pending test with a large amount of text could cause node to run out of memory. See [#94](https://github.com/adamgruber/mochawesome/issues/94)

###1.5.3
- Fixed build issues on Windows. See [#84](https://github.com/adamgruber/mochawesome/pull/84)

Expand Down
2 changes: 1 addition & 1 deletion lib/mochawesome.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function Mochawesome (runner, options) {
stats: self.stats,
suites: allSuites,
allTests: allTests.map(cleanTest),
allPending: allPending,
allPending: allPending.map(cleanTest),
allPasses: allPasses.map(cleanTest),
allFailures: allFailures.map(cleanTest),
copyrightYear: new Date().getFullYear()
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mochawesome",
"version": "1.5.3",
"version": "1.5.4",
"description": "A Gorgeous HTML/CSS Reporter for Mocha.js",
"scripts": {
"test": "gulp build"
Expand Down
224 changes: 115 additions & 109 deletions test/basic/mem-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,113 +3,119 @@

describe('mochawesome hook test', function() {

// Change this to drastically alter the memory impact
var numTests = 1000;

before('before hook 1', function(done) {
done();
});

before('before hook 2', function(done) {
done();
});

before('before hook 3', function(done) {
done();
});

before('before hook 4', function(done) {
done();
});

before('before hook 5', function(done) {
done();
});

before('before hook 6', function(done) {
done();
});

before('before hook 7', function(done) {
done();
});

before('before hook 8', function(done) {
done();
});

beforeEach('beforeEach hook 1', function(done) {
done();
});

beforeEach('beforeEach hook 2', function(done) {
done();
});

beforeEach('beforeEach hook 3', function(done) {
done();
});

beforeEach('beforeEach hook 4', function(done) {
done();
});

afterEach('afterEach hook 1', function(done) {
done();
});

afterEach('afterEach hook 2', function(done) {
done();
});

after('after hook 1', function(done) {
done();
});

after('after hook 2', function(done) {
done();
});

for (var i=1; i<=numTests; i++) {
it( 'test ' + i, genTestBody() );
}

function genTestBody() {
return function(done) {
// This just needs to contain a lot of stuff.
// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
done();
}
}
// Change this to drastically alter the memory impact
var numTests = 1000;

before('before hook 1', function(done) {
done();
});

before('before hook 2', function(done) {
done();
});

before('before hook 3', function(done) {
done();
});

before('before hook 4', function(done) {
done();
});

before('before hook 5', function(done) {
done();
});

before('before hook 6', function(done) {
done();
});

before('before hook 7', function(done) {
done();
});

before('before hook 8', function(done) {
done();
});

beforeEach('beforeEach hook 1', function(done) {
done();
});

beforeEach('beforeEach hook 2', function(done) {
done();
});

beforeEach('beforeEach hook 3', function(done) {
done();
});

beforeEach('beforeEach hook 4', function(done) {
done();
});

afterEach('afterEach hook 1', function(done) {
done();
});

afterEach('afterEach hook 2', function(done) {
done();
});

after('after hook 1', function(done) {
done();
});

after('after hook 2', function(done) {
done();
});

for (var i=1; i<=numTests; i++) {
it( 'test ' + i, genTestBody() );
}

// skipped tests
for (var i=1; i<=numTests; i++) {
it( 'skipped test ' + i, genTestBody(true) );
}

function genTestBody(skip) {
return function(done) {
// This just needs to contain a lot of stuff.
// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
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