| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,6 +8,9 @@ describe("Revwalk", function() { | |||
| 8 | 8 | var Revwalk = require("../../lib/revwalk"); | |
| 9 | 9 | var Oid = require("../../lib/oid"); | |
| 10 | 10 | ||
| 11 | + // Set a reasonable timeout here now that our repository has grown. | ||
| 12 | + this.timeout(150000); | ||
| 13 | + | ||
| 11 | 14 | before(function(done) { | |
| 12 | 15 | var test = this; | |
| 13 | 16 | return Repository.open(reposPath).then(function(repository) { | |
@@ -81,34 +84,29 @@ describe("Revwalk", function() { | |||
| 81 | 84 | }); | |
| 82 | 85 | }); | |
| 83 | 86 | ||
| 84 | - // This test requires forcing garbage collection, so mocha needs to be run via | ||
| 85 | - // node rather than npm, with a la `node --expose-gc [pathtohmoca] [testglob]` | ||
| 86 | - var testGC = (global.gc ? it : it.skip); | ||
| 87 | + // This test requires forcing garbage collection, so mocha needs to be run | ||
| 88 | + // via node rather than npm, with a la `node --expose-gc [pathtohmoca] | ||
| 89 | + // [testglob]` | ||
| 90 | + var testGC = global.gc ? it : it.skip; | ||
| 87 | 91 | ||
| 88 | 92 | testGC("doesnt segfault when accessing .author() twice", function(done) { | |
| 89 | - this.timeout(10000); | ||
| 90 | - | ||
| 91 | - return Repository.open(reposPath).then(function(repository) { | ||
| 93 | + Repository.open(reposPath).then(function(repository) { | ||
| 92 | 94 | var walker = repository.createRevWalk(); | |
| 93 | - return repository.getMasterCommit().then(function(firstCommitOnMaster) { | ||
| 94 | - var did = false; | ||
| 95 | - walker.walk(firstCommitOnMaster, function(error, commit) { | ||
| 95 | + | ||
| 96 | + repository.getMasterCommit().then(function(firstCommitOnMaster) { | ||
| 97 | + walker.walk(firstCommitOnMaster, function(err, commit) { | ||
| 98 | + if (!err && !commit) { | ||
| 99 | + return done(); | ||
| 100 | + } | ||
| 101 | + | ||
| 96 | 102 | for (var i = 0; i < 1000; i++) { | |
| 97 | - if (true) { | ||
| 98 | - commit.author().name(); | ||
| 99 | - commit.author().email(); | ||
| 100 | - } | ||
| 103 | + commit.author().name(); | ||
| 104 | + commit.author().email(); | ||
| 105 | + | ||
| 101 | 106 | global.gc(); | |
| 102 | 107 | } | |
| 103 | - if (!did) { | ||
| 104 | - done(); | ||
| 105 | - did = true; | ||
| 106 | - } | ||
| 107 | 108 | }); | |
| 108 | 109 | }); | |
| 109 | - }).then(function() { | ||
| 110 | - global.gc(); | ||
| 111 | 110 | }); | |
| 112 | 111 | }); | |
| 113 | - | ||
| 114 | 112 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments