aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-07-07 13:04:05 +0200
committerHampusM <hampus@hampusmat.com>2021-07-07 13:04:05 +0200
commitc7d7d1e207babcf1d33b305811556687b0a85dd5 (patch)
tree5b6b46c3c1cb1d0099ac78b4ce69655f68a7e6fe /test
parent6e7365a8c47c89eaab93c73e4a0b4ce4e69d0cb1 (diff)
The test setup clones a repository instead of assuming there is content in .git
Diffstat (limited to 'test')
-rw-r--r--test/setup.ts17
-rw-r--r--test/test.env1
2 files changed, 5 insertions, 13 deletions
diff --git a/test/setup.ts b/test/setup.ts
index d0b1410..3eaa5e7 100644
--- a/test/setup.ts
+++ b/test/setup.ts
@@ -1,4 +1,4 @@
-import { access, mkdir, remove, copy } from "fs-extra";
+import { access, mkdir, remove } from "fs-extra";
import { promisify } from "util";
import { exec } from "child_process";
import { config } from "dotenv";
@@ -11,24 +11,15 @@ export default async function init() {
.then(() => true)
.catch(() => false);
- console.log(can_access);
-
if(can_access) {
await remove(process.env.BASE_DIR);
}
await mkdir(process.env.BASE_DIR);
- await mkdir(`${process.env.BASE_DIR}/${process.env.AVAIL_REPO}`);
-
- await copy(".git", `${process.env.BASE_DIR}/${process.env.AVAIL_REPO}`);
- process.chdir(`${process.env.BASE_DIR}/${process.env.AVAIL_REPO}`);
+ const git_clone = await promiseExec(`git clone -q --bare ${process.env.AVAIL_REPO_URL} ${process.env.BASE_DIR}/${process.env.AVAIL_REPO}`);
- const { stdout, stderr } = await promiseExec("git config core.bare true");
-
- if(stderr) {
- throw(stderr);
+ if(git_clone.stderr) {
+ throw(git_clone.stderr);
}
-
- process.chdir("../..");
} \ No newline at end of file
diff --git a/test/test.env b/test/test.env
index 4ff13ac..2742aac 100644
--- a/test/test.env
+++ b/test/test.env
@@ -1,5 +1,6 @@
BASE_DIR=git
AVAIL_REPO=githermit.git
+AVAIL_REPO_URL=https://gitlab.com/HampusMat/githermit.git
UNAVAIL_REPO=angular
AVAIL_OBJECT=16778756fb25808a1311403590cd7d36fbbeee6c
UNAVAIL_OBJECT=601747563bff808a1d12403690cd7d36fbbeafcc