MCPcopy Index your code
hub / github.com/changesets/changesets / testSetup

Function testSetup

packages/apply-release-plan/src/index.test.ts:81–132  ·  view source on GitHub ↗
(
  fixture: Fixture,
  releasePlan: ReleasePlan,
  config?: Config,
  snapshot?: string | undefined,
  setupFunc?: (tempDir: string) => Promise<unknown>
)

Source from the content-addressed store, hash-verified

79}
80
81async function testSetup(
82 fixture: Fixture,
83 releasePlan: ReleasePlan,
84 config?: Config,
85 snapshot?: string | undefined,
86 setupFunc?: (tempDir: string) => Promise<unknown>
87) {
88 if (!config) {
89 config = {
90 changelog: false,
91 commit: false,
92 fixed: [],
93 linked: [],
94 access: "restricted",
95 changedFilePatterns: ["**"],
96 baseBranch: "main",
97 updateInternalDependencies: "patch",
98 ignore: [],
99 prettier: true,
100 privatePackages: { version: true, tag: false },
101 snapshot: {
102 useCalculatedVersion: false,
103 prereleaseTemplate: null,
104 },
105 ___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH: {
106 onlyUpdatePeerDependentsWhenOutOfRange: false,
107 updateInternalDependents: "out-of-range",
108 },
109 };
110 }
111 let tempDir = await testdir(fixture);
112
113 if (setupFunc) {
114 await setupFunc(tempDir);
115 }
116
117 if (config.commit) {
118 await spawn("git", ["init"], { cwd: tempDir });
119 await git.add(".", tempDir);
120 await git.commit("first commit", tempDir);
121 }
122
123 return {
124 changedFiles: await applyReleasePlan(
125 releasePlan,
126 await getPackages(tempDir),
127 config,
128 snapshot
129 ),
130 tempDir,
131 };
132}
133
134describe("apply release plan", () => {
135 describe("versioning", () => {

Callers 1

index.test.tsFile · 0.85

Calls 3

testdirFunction · 0.90
setupFuncFunction · 0.85
applyReleasePlanFunction · 0.85

Tested by

no test coverage detected