| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 796c09f commit e19e8ea
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,3 +45,18 @@ beforeEach(function() { | |||
| 45 | 45 | return exec("git reset --hard", {cwd: workdirPath}); | |
| 46 | 46 | }); | |
| 47 | 47 | }); | |
| 48 | + | ||
| 49 | + afterEach(function(done) { | ||
| 50 | + // In Windows if you do not clean up the repository, there may become a | ||
| 51 | + // conflict with file locking. | ||
| 52 | + if (this.repository && process.platform === "win32") { | ||
| 53 | + this.repository.stateCleanup(); | ||
| 54 | + this.repository.free(); | ||
| 55 | + delete this.repository; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + process.nextTick(function() { | ||
| 59 | + global.gc(); | ||
| 60 | + done(); | ||
| 61 | + }); | ||
| 62 | + }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,13 +16,13 @@ describe("Branch", function() { | |||
| 16 | 16 | ||
| 17 | 17 | return Repository.open(reposPath) | |
| 18 | 18 | .then(function(repository) { | |
| 19 | - test.repo = repository; | ||
| 19 | + test.repository = repository; | ||
| 20 | 20 | }); | |
| 21 | 21 | }); | |
| 22 | 22 | ||
| 23 | 23 | beforeEach(function() { | |
| 24 | 24 | var test = this; | |
| 25 | - var repo = test.repo; | ||
| 25 | + var repo = test.repository; | ||
| 26 | 26 | ||
| 27 | 27 | return repo.getMasterCommit() | |
| 28 | 28 | .then(function(masterCommit) { | |
@@ -44,7 +44,7 @@ describe("Branch", function() { | |||
| 44 | 44 | }); | |
| 45 | 45 | ||
| 46 | 46 | it("can delete a branch", function() { | |
| 47 | - var repo = this.repo; | ||
| 47 | + var repo = this.repository; | ||
| 48 | 48 | ||
| 49 | 49 | Branch.delete(this.branch); | |
| 50 | 50 | ||
@@ -54,7 +54,7 @@ describe("Branch", function() { | |||
| 54 | 54 | }); | |
| 55 | 55 | ||
| 56 | 56 | it("can see if the branch is pointed to by head", function() { | |
| 57 | - var repo = this.repo; | ||
| 57 | + var repo = this.repository; | ||
| 58 | 58 | ||
| 59 | 59 | return repo.getBranch("master") | |
| 60 | 60 | .then(function(branch) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,16 +14,16 @@ describe("Checkout", function() { | |||
| 14 | 14 | ||
| 15 | 15 | return Repository.open(reposPath) | |
| 16 | 16 | .then(function(repo) { | |
| 17 | - test.repo = repo; | ||
| 17 | + test.repository = repo; | ||
| 18 | 18 | }); | |
| 19 | 19 | }); | |
| 20 | 20 | ||
| 21 | 21 | it("can checkout the head", function() { | |
| 22 | 22 | var test = this; | |
| 23 | 23 | ||
| 24 | - return Checkout.head(test.repo) | ||
| 24 | + return Checkout.head(test.repository) | ||
| 25 | 25 | .then(function() { | |
| 26 | - return test.repo.getBlob(packageJsonOid); | ||
| 26 | + return test.repository.getBlob(packageJsonOid); | ||
| 27 | 27 | }) | |
| 28 | 28 | .then(function(blob) { | |
| 29 | 29 | var packageJson = blob.toString(); | |
@@ -35,10 +35,10 @@ describe("Checkout", function() { | |||
| 35 | 35 | it("can checkout by tree", function() { | |
| 36 | 36 | var test = this; | |
| 37 | 37 | ||
| 38 | - return test.repo.getTagByName("annotated-tag").then(function(tag) { | ||
| 39 | - return Checkout.tree(test.repo, test.tag); | ||
| 38 | + return test.repository.getTagByName("annotated-tag").then(function(tag) { | ||
| 39 | + return Checkout.tree(test.repository, test.tag); | ||
| 40 | 40 | }).then(function() { | |
| 41 | - return test.repo.getHeadCommit(); | ||
| 41 | + return test.repository.getHeadCommit(); | ||
| 42 | 42 | }).then(function(commit) { | |
| 43 | 43 | assert.equal(commit, "32789a79e71fbc9e04d3eff7425e1771eb595150"); | |
| 44 | 44 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,25 +18,10 @@ describe("Clone", function() { | |||
| 18 | 18 | this.timeout(30000); | |
| 19 | 19 | ||
| 20 | 20 | beforeEach(function() { | |
| 21 | - if (this.clonePath) { | ||
| 22 | - return fse.remove(this.clonePath).catch(function(err) { | ||
| 23 | - console.log(err); | ||
| 21 | + return fse.remove(clonePath).catch(function(err) { | ||
| 22 | + console.log(err); | ||
| 24 | 23 | ||
| 25 | - throw err; | ||
| 26 | - }); | ||
| 27 | - } | ||
| 28 | - }); | ||
| 29 | - | ||
| 30 | - afterEach(function(done) { | ||
| 31 | - if (this.repository) { | ||
| 32 | - this.repository.stateCleanup(); | ||
| 33 | - this.repository.free(); | ||
| 34 | - delete this.repository; | ||
| 35 | - } | ||
| 36 | - | ||
| 37 | - process.nextTick(function() { | ||
| 38 | - global.gc(); | ||
| 39 | - done(); | ||
| 24 | + throw err; | ||
| 40 | 25 | }); | |
| 41 | 26 | }); | |
| 42 | 27 | ||
@@ -51,9 +36,7 @@ describe("Clone", function() { | |||
| 51 | 36 | } | |
| 52 | 37 | }; | |
| 53 | 38 | ||
| 54 | - test.clonePath = local("../repos/http"); | ||
| 55 | - | ||
| 56 | - return Clone.clone(url, test.clonePath, opts).then(function(repo) { | ||
| 39 | + return Clone.clone(url, clonePath, opts).then(function(repo) { | ||
| 57 | 40 | assert.ok(repo instanceof Repository); | |
| 58 | 41 | test.repository = repo; | |
| 59 | 42 | }); | |
@@ -70,9 +53,7 @@ describe("Clone", function() { | |||
| 70 | 53 | } | |
| 71 | 54 | }; | |
| 72 | 55 | ||
| 73 | - test.clonePath = local("../repos/https"); | ||
| 74 | - | ||
| 75 | - return Clone.clone(url, test.clonePath, opts).then(function(repo) { | ||
| 56 | + return Clone.clone(url, clonePath, opts).then(function(repo) { | ||
| 76 | 57 | assert.ok(repo instanceof Repository); | |
| 77 | 58 | test.repository = repo; | |
| 78 | 59 | }); | |
@@ -92,9 +73,7 @@ describe("Clone", function() { | |||
| 92 | 73 | } | |
| 93 | 74 | }; | |
| 94 | 75 | ||
| 95 | - test.clonePath = local("../repos/ssh"); | ||
| 96 | - | ||
| 97 | - return Clone.clone(url, test.clonePath, opts).then(function(repo) { | ||
| 76 | + return Clone.clone(url, clonePath, opts).then(function(repo) { | ||
| 98 | 77 | assert.ok(repo instanceof Repository); | |
| 99 | 78 | test.repository = repo; | |
| 100 | 79 | }); | |
@@ -118,9 +97,7 @@ describe("Clone", function() { | |||
| 118 | 97 | } | |
| 119 | 98 | }; | |
| 120 | 99 | ||
| 121 | - test.clonePath = local("../repos/sshManual"); | ||
| 122 | - | ||
| 123 | - return Clone.clone(url, test.clonePath, opts).then(function(repo) { | ||
| 100 | + return Clone.clone(url, clonePath, opts).then(function(repo) { | ||
| 124 | 101 | assert.ok(repo instanceof Repository); | |
| 125 | 102 | test.repository = repo; | |
| 126 | 103 | }); | |
@@ -137,9 +114,7 @@ describe("Clone", function() { | |||
| 137 | 114 | } | |
| 138 | 115 | }; | |
| 139 | 116 | ||
| 140 | - test.clonePath = local("../repos/git"); | ||
| 141 | - | ||
| 142 | - return Clone.clone(url, test.clonePath, opts).then(function(repo) { | ||
| 117 | + return Clone.clone(url, clonePath, opts).then(function(repo) { | ||
| 143 | 118 | test.repository = repo; | |
| 144 | 119 | assert.ok(repo instanceof Repository); | |
| 145 | 120 | }); | |
@@ -150,9 +125,7 @@ describe("Clone", function() { | |||
| 150 | 125 | var prefix = process.platform === "win32" ? "" : "file://"; | |
| 151 | 126 | var url = prefix + local("../repos/empty"); | |
| 152 | 127 | ||
| 153 | - test.clonePath = local("../repos/filesystem"); | ||
| 154 | - | ||
| 155 | - return Clone.clone(url, test.clonePath).then(function(repo) { | ||
| 128 | + return Clone.clone(url, clonePath).then(function(repo) { | ||
| 156 | 129 | assert.ok(repo instanceof Repository); | |
| 157 | 130 | test.repository = repo; | |
| 158 | 131 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,7 +19,7 @@ describe("Index", function() { | |||
| 19 | 19 | ||
| 20 | 20 | return Repository.open(reposPath) | |
| 21 | 21 | .then(function(repo) { | |
| 22 | - test.repo = repo; | ||
| 22 | + test.repository = repo; | ||
| 23 | 23 | return repo.openIndex(); | |
| 24 | 24 | }) | |
| 25 | 25 | .then(function(index) { | |
@@ -38,7 +38,7 @@ describe("Index", function() { | |||
| 38 | 38 | }); | |
| 39 | 39 | ||
| 40 | 40 | it("can add all entries to the index", function() { | |
| 41 | - var repo = this.repo; | ||
| 41 | + var repo = this.repository; | ||
| 42 | 42 | var index = this.index; | |
| 43 | 43 | var fileContent = { | |
| 44 | 44 | newFile1: "this has some content", | |
@@ -72,7 +72,7 @@ describe("Index", function() { | |||
| 72 | 72 | }); | |
| 73 | 73 | ||
| 74 | 74 | it("can remove entries from the index", function() { | |
| 75 | - var repo = this.repo; | ||
| 75 | + var repo = this.repository; | ||
| 76 | 76 | var index = this.index; | |
| 77 | 77 | var fileContent = { | |
| 78 | 78 | newFile1: "this has some content", | |
@@ -116,7 +116,7 @@ describe("Index", function() { | |||
| 116 | 116 | }); | |
| 117 | 117 | ||
| 118 | 118 | it("can update entries in the index", function() { | |
| 119 | - var repo = this.repo; | ||
| 119 | + var repo = this.repository; | ||
| 120 | 120 | var index = this.index; | |
| 121 | 121 | var fileContent = { | |
| 122 | 122 | newFile1: "this has some content", | |
| Back | FazBrowse Home | New Git URL |
0 commit comments