MCPcopy
hub / github.com/garrytan/gstack / snapshotFixture

Function snapshotFixture

test/skill-e2e-ship-idempotency.test.ts:133–149  ·  view source on GitHub ↗
(workTree: string)

Source from the content-addressed store, hash-verified

131}
132
133function snapshotFixture(workTree: string): FixtureSnapshot {
134 const versionFile = fs.readFileSync(path.join(workTree, 'VERSION'), 'utf-8').trim();
135 const pkg = JSON.parse(fs.readFileSync(path.join(workTree, 'package.json'), 'utf-8'));
136 const changelog = fs.readFileSync(path.join(workTree, 'CHANGELOG.md'), 'utf-8');
137 // Count `## [0.0.2]` headings — should stay at 1 across re-runs.
138 const changelogEntryCount = (changelog.match(/^##\s*\[0\.0\.2\]/gm) ?? []).length;
139 const head = spawnSync('git', ['rev-parse', 'HEAD'], { cwd: workTree, stdio: 'pipe' });
140 const branchHead = head.stdout?.toString().trim() ?? '';
141 // Count "chore: bump version" commits on this branch since main.
142 const log = spawnSync(
143 'git', ['log', '--format=%s', 'main..HEAD'],
144 { cwd: workTree, stdio: 'pipe' },
145 );
146 const subjects = log.stdout?.toString() ?? '';
147 const bumpCommitCount = subjects.split('\n').filter(s => /chore:\s*bump\s+version/i.test(s)).length;
148 return { versionFile, packageVersion: pkg.version, changelogEntryCount, bumpCommitCount, branchHead };
149}
150
151describeE2E('/ship idempotency E2E (periodic, real-PTY)', () => {
152 test(

Calls 1

spawnSyncFunction · 0.85

Tested by

no test coverage detected