Skip to content

Commit 91399a0

Browse files
authored
✅ fix the broken E2E tests due to the addition of OCO_GITPUSH (#321)
* test(oneFile.test.ts): update test expectations to match new push prompt text * build
1 parent a448089 commit 91399a0

File tree

3 files changed

+33
-11
lines changed

3 files changed

+33
-11
lines changed

out/cli.cjs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18755,10 +18755,11 @@ var configValidators = {
1875518755
"gpt-3.5-turbo-0125",
1875618756
"gpt-4",
1875718757
"gpt-4-1106-preview",
18758-
"gpt-4-turbo-preview",
18759-
"gpt-4-0125-preview"
18758+
"gpt-4-0125-preview",
18759+
"gpt-4-turbo",
18760+
"gpt-4-turbo-preview"
1876018761
].includes(value),
18761-
`${value} is not supported yet, use 'gpt-4', 'gpt-3.5-turbo' (default), 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-turbo-preview' or 'gpt-4-0125-preview'`
18762+
`${value} is not supported yet, use 'gpt-4', 'gpt-4-turbo', 'gpt-3.5-turbo' (default), 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-0125-preview' or 'gpt-4-turbo-preview'`
1876218763
);
1876318764
return value;
1876418765
},
@@ -18778,6 +18779,14 @@ var configValidators = {
1877818779
);
1877918780
return value;
1878018781
},
18782+
["OCO_GITPUSH" /* OCO_GITPUSH */](value) {
18783+
validateConfig(
18784+
"OCO_GITPUSH" /* OCO_GITPUSH */,
18785+
typeof value === "boolean",
18786+
"Must be true or false"
18787+
);
18788+
return value;
18789+
},
1878118790
["OCO_AI_PROVIDER" /* OCO_AI_PROVIDER */](value) {
1878218791
validateConfig(
1878318792
"OCO_AI_PROVIDER" /* OCO_AI_PROVIDER */,
@@ -18814,6 +18823,7 @@ var getConfig = () => {
1881418823
OCO_MESSAGE_TEMPLATE_PLACEHOLDER: process.env.OCO_MESSAGE_TEMPLATE_PLACEHOLDER || "$msg",
1881518824
OCO_PROMPT_MODULE: process.env.OCO_PROMPT_MODULE || "conventional-commit",
1881618825
OCO_AI_PROVIDER: process.env.OCO_AI_PROVIDER || "openai",
18826+
OCO_GITPUSH: process.env.OCO_GITPUSH === "false" ? false : true,
1881718827
OCO_ONE_LINE_COMMIT: process.env.OCO_ONE_LINE_COMMIT === "true" ? true : false
1881818828
};
1881918829
const configExists = (0, import_fs.existsSync)(configPath);
@@ -18822,7 +18832,7 @@ var getConfig = () => {
1882218832
const configFile = (0, import_fs.readFileSync)(configPath, "utf8");
1882318833
const config8 = (0, import_ini.parse)(configFile);
1882418834
for (const configKey of Object.keys(config8)) {
18825-
if (!config8[configKey] || ["null", "undefined"].includes(config8[configKey])) {
18835+
if (["null", "undefined"].includes(config8[configKey])) {
1882618836
config8[configKey] = void 0;
1882718837
continue;
1882818838
}
@@ -22472,13 +22482,15 @@ ${source_default.grey("\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2
2247222482
ce(`${source_default.green("\u2714")} Successfully committed`);
2247322483
ce(stdout);
2247422484
const remotes = await getGitRemotes();
22485+
if (config7?.OCO_GITPUSH === false)
22486+
return;
2247522487
if (!remotes.length) {
2247622488
const { stdout: stdout2 } = await execa("git", ["push"]);
2247722489
if (stdout2)
2247822490
ce(stdout2);
2247922491
process.exit(0);
2248022492
}
22481-
if (remotes.length === 1) {
22493+
if (remotes.length === 1 && config7?.OCO_GITPUSH !== true) {
2248222494
const isPushConfirmedByUser = await Q3({
2248322495
message: "Do you want to run `git push`?"
2248422496
});

out/github-action.cjs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24244,10 +24244,11 @@ var configValidators = {
2424424244
"gpt-3.5-turbo-0125",
2424524245
"gpt-4",
2424624246
"gpt-4-1106-preview",
24247-
"gpt-4-turbo-preview",
24248-
"gpt-4-0125-preview"
24247+
"gpt-4-0125-preview",
24248+
"gpt-4-turbo",
24249+
"gpt-4-turbo-preview"
2424924250
].includes(value),
24250-
`${value} is not supported yet, use 'gpt-4', 'gpt-3.5-turbo' (default), 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-turbo-preview' or 'gpt-4-0125-preview'`
24251+
`${value} is not supported yet, use 'gpt-4', 'gpt-4-turbo', 'gpt-3.5-turbo' (default), 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-0125-preview' or 'gpt-4-turbo-preview'`
2425124252
);
2425224253
return value;
2425324254
},
@@ -24267,6 +24268,14 @@ var configValidators = {
2426724268
);
2426824269
return value;
2426924270
},
24271+
["OCO_GITPUSH" /* OCO_GITPUSH */](value) {
24272+
validateConfig(
24273+
"OCO_GITPUSH" /* OCO_GITPUSH */,
24274+
typeof value === "boolean",
24275+
"Must be true or false"
24276+
);
24277+
return value;
24278+
},
2427024279
["OCO_AI_PROVIDER" /* OCO_AI_PROVIDER */](value) {
2427124280
validateConfig(
2427224281
"OCO_AI_PROVIDER" /* OCO_AI_PROVIDER */,
@@ -24303,6 +24312,7 @@ var getConfig = () => {
2430324312
OCO_MESSAGE_TEMPLATE_PLACEHOLDER: process.env.OCO_MESSAGE_TEMPLATE_PLACEHOLDER || "$msg",
2430424313
OCO_PROMPT_MODULE: process.env.OCO_PROMPT_MODULE || "conventional-commit",
2430524314
OCO_AI_PROVIDER: process.env.OCO_AI_PROVIDER || "openai",
24315+
OCO_GITPUSH: process.env.OCO_GITPUSH === "false" ? false : true,
2430624316
OCO_ONE_LINE_COMMIT: process.env.OCO_ONE_LINE_COMMIT === "true" ? true : false
2430724317
};
2430824318
const configExists = (0, import_fs.existsSync)(configPath);
@@ -24311,7 +24321,7 @@ var getConfig = () => {
2431124321
const configFile = (0, import_fs.readFileSync)(configPath, "utf8");
2431224322
const config7 = (0, import_ini.parse)(configFile);
2431324323
for (const configKey of Object.keys(config7)) {
24314-
if (!config7[configKey] || ["null", "undefined"].includes(config7[configKey])) {
24324+
if (["null", "undefined"].includes(config7[configKey])) {
2431524325
config7[configKey] = void 0;
2431624326
continue;
2431724327
}

test/e2e/oneFile.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ it('cli flow to generate commit message for 1 new file (staged)', async () => {
1818
expect(await findByText('Confirm the commit message?')).toBeInTheConsole();
1919
userEvent.keyboard('[Enter]');
2020

21-
expect(await findByText('Do you want to run `git push`?')).toBeInTheConsole();
21+
expect(await findByText('Choose a remote to push to')).toBeInTheConsole();
2222
userEvent.keyboard('[Enter]');
2323

2424
expect(await findByText('Successfully pushed all commits to origin')).toBeInTheConsole();
@@ -47,7 +47,7 @@ it('cli flow to generate commit message for 1 changed file (not staged)', async
4747

4848
expect(await findByText('Successfully committed')).toBeInTheConsole();
4949

50-
expect(await findByText('Do you want to run `git push`?')).toBeInTheConsole();
50+
expect(await findByText('Choose a remote to push to')).toBeInTheConsole();
5151
userEvent.keyboard('[Enter]');
5252

5353
expect(await findByText('Successfully pushed all commits to origin')).toBeInTheConsole();

0 commit comments

Comments
 (0)