forked from JoshuaKGoldberg/create-typescript-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaugmentOptionsWithExcludes.test.ts
130 lines (116 loc) · 3.28 KB
/
augmentOptionsWithExcludes.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import { describe, expect, it } from "vitest";
import { Options } from "../types.js";
import { augmentOptionsWithExcludes } from "./augmentOptionsWithExcludes.js";
const optionsBase = {
access: "public",
author: undefined,
base: "everything",
description: "",
directory: ".",
email: {
github: "[email protected]",
npm: "[email protected]",
},
excludeAllContributors: undefined,
excludeCompliance: undefined,
excludeLintDeprecation: undefined,
excludeLintESLint: undefined,
excludeLintJSDoc: undefined,
excludeLintJson: undefined,
excludeLintKnip: undefined,
excludeLintMd: undefined,
excludeLintPackageJson: undefined,
excludeLintPackages: undefined,
excludeLintPerfectionist: undefined,
excludeLintRegex: undefined,
excludeLintSpelling: undefined,
excludeLintStrict: undefined,
excludeLintStylistic: undefined,
excludeLintYml: undefined,
excludeReleases: undefined,
excludeRenovate: undefined,
excludeTests: undefined,
funding: undefined,
logo: undefined,
mode: "create",
offline: true,
owner: "",
repository: "",
skipGitHubApi: false,
skipInstall: undefined,
skipRemoval: undefined,
skipRestore: undefined,
skipUninstall: undefined,
title: "",
} satisfies Options;
describe("augmentOptionsWithExcludes", () => {
it("returns options without exclusions and skips prompting when exclusions are provided manually", async () => {
const options = {
...optionsBase,
excludeCompliance: true,
} satisfies Options;
const actual = await augmentOptionsWithExcludes(options);
expect(actual).toBe(options);
});
it("uses the 'common' base without prompting when provided manually", async () => {
const options = {
...optionsBase,
base: "common",
} satisfies Options;
const actual = await augmentOptionsWithExcludes(options);
expect(actual).toEqual({
...options,
excludeCompliance: true,
excludeLintDeprecation: true,
excludeLintESLint: true,
excludeLintJSDoc: true,
excludeLintJson: true,
excludeLintMd: true,
excludeLintPackageJson: true,
excludeLintPackages: true,
excludeLintPerfectionist: true,
excludeLintRegex: true,
excludeLintSpelling: true,
excludeLintStrict: true,
excludeLintStylistic: true,
excludeLintYml: true,
});
});
it("uses the 'minimum' base without prompting when provided manually", async () => {
const options = {
...optionsBase,
base: "minimum",
} satisfies Options;
const actual = await augmentOptionsWithExcludes(options);
expect(actual).toEqual({
...options,
excludeAllContributors: true,
excludeCompliance: true,
excludeLintDeprecation: true,
excludeLintESLint: true,
excludeLintJSDoc: true,
excludeLintJson: true,
excludeLintKnip: true,
excludeLintMd: true,
excludeLintPackageJson: true,
excludeLintPackages: true,
excludeLintPerfectionist: true,
excludeLintRegex: true,
excludeLintSpelling: true,
excludeLintStrict: true,
excludeLintStylistic: true,
excludeLintYml: true,
excludeReleases: true,
excludeRenovate: true,
excludeTests: true,
});
});
it("uses the 'everything' base without prompting when provided manually", async () => {
const options = {
...optionsBase,
base: "everything",
} satisfies Options;
const actual = await augmentOptionsWithExcludes(options);
expect(actual).toStrictEqual(options);
});
});