Skip to content

Commit

Permalink
chore: run fixture commands in /tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
domharrington committed Jun 17, 2024
1 parent 20f0157 commit 6612fc8
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/gitlog.test.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import fs from "fs";
import os from "os";
import { execSync } from "child_process";
import gitlog from "../src";

const testRepoLocation = `${__dirname}/test-repo-clone`;
const testRepoLocation = `${os.tmpdir()}/test-repo-clone`;

function execInTestDir(command: string) {
execSync(command, { cwd: __dirname, stdio: "ignore" });
function execInTmpDir(command: string) {
execSync(command, { cwd: os.tmpdir(), stdio: "ignore" });
}

describe("gitlog", () => {
beforeEach(() => {
execInTestDir(`${__dirname}/delete-repo.sh`);
execInTestDir(`${__dirname}/create-repo.sh`);
execInTmpDir(`${__dirname}/delete-repo.sh`);
execInTmpDir(`${__dirname}/create-repo.sh`);
});

afterAll(() => {
execInTestDir(`${__dirname}/delete-repo.sh`);
execInTmpDir(`${__dirname}/delete-repo.sh`);
});

it("throws an error when repo is not provided", async () => {
Expand Down

0 comments on commit 6612fc8

Please sign in to comment.