MCPcopy Create free account
hub / github.com/github/gh-aw / runChangesetVersion

Function runChangesetVersion

scripts/changeset.test.js:73–91  ·  view source on GitHub ↗

* Run changeset version command and capture output

()

Source from the content-addressed store, hash-verified

71 * Run changeset version command and capture output
72 */
73function runChangesetVersion() {
74 try {
75 // Set up git for testing
76 execSync("git init", { cwd: TEST_DIR, stdio: "ignore" });
77 execSync('git config user.email "test@example.com"', { cwd: TEST_DIR, stdio: "ignore" });
78 execSync('git config user.name "Test User"', { cwd: TEST_DIR, stdio: "ignore" });
79
80 // Run version command by requiring and calling main
81 // Need to set up process.argv properly: [node, scriptname, command, ...]
82 const output = execSync(`node -e "process.argv.splice(1, 0, 'changeset.js', 'version'); const {main} = require('${CHANGESET_SCRIPT}'); main().catch(console.error);"`, {
83 cwd: TEST_DIR,
84 encoding: "utf8",
85 env: { ...process.env, GH_AW_CURRENT_VERSION: "v0.1.0" },
86 });
87 return output;
88 } catch (error) {
89 return error.stdout || error.message;
90 }
91}
92
93/**
94 * Clean up test directory

Callers 1

runTestsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected