-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow chmod to fail in setup (#1197)
## PR Checklist - [x] Addresses an existing open issue: fixes #1195 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md) were taken ## Overview Wraps the `chmod` with a `try`/`catch`. I figure if it fails then that's probably a sign the running OS doesn't have it and therefore doesn't need it.
- Loading branch information
1 parent
ff5f7fd
commit 4568cb9
Showing
2 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { describe, expect, it, vi } from "vitest"; | ||
|
||
import { Options } from "../../shared/types.js"; | ||
import { writeStructure } from "./writeStructure.js"; | ||
|
||
const mock$ = vi.fn(); | ||
|
||
vi.mock("execa", () => ({ | ||
get $() { | ||
return mock$; | ||
}, | ||
})); | ||
|
||
vi.mock("./creation/index.js"); | ||
vi.mock("./writeStructureWorker.js"); | ||
|
||
const options = { | ||
access: "public", | ||
author: "TestAuthor", | ||
base: "everything", | ||
description: "Test description.", | ||
directory: ".", | ||
email: { | ||
github: "[email protected]", | ||
npm: "[email protected]", | ||
}, | ||
keywords: ["abc", "def ghi", "jkl mno pqr"], | ||
mode: "create", | ||
owner: "TestOwner", | ||
repository: "test-repository", | ||
title: "Test Title", | ||
} satisfies Options; | ||
|
||
describe("writeStructure", () => { | ||
it("resolves when chmod resolves", async () => { | ||
mock$.mockResolvedValue(undefined); | ||
|
||
await expect(writeStructure(options)).resolves.toBeUndefined(); | ||
}); | ||
|
||
it("resolves when chmod rejects", async () => { | ||
mock$.mockRejectedValue(new Error("Oh no!")); | ||
|
||
await expect(writeStructure(options)).resolves.toBeUndefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters