✅ 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
This commit is contained in:
committed by
GitHub
parent
a4480893cb
commit
91399a0c68
+17
-5
@@ -18755,10 +18755,11 @@ var configValidators = {
|
|||||||
"gpt-3.5-turbo-0125",
|
"gpt-3.5-turbo-0125",
|
||||||
"gpt-4",
|
"gpt-4",
|
||||||
"gpt-4-1106-preview",
|
"gpt-4-1106-preview",
|
||||||
"gpt-4-turbo-preview",
|
"gpt-4-0125-preview",
|
||||||
"gpt-4-0125-preview"
|
"gpt-4-turbo",
|
||||||
|
"gpt-4-turbo-preview"
|
||||||
].includes(value),
|
].includes(value),
|
||||||
`${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'`
|
`${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'`
|
||||||
);
|
);
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
@@ -18778,6 +18779,14 @@ var configValidators = {
|
|||||||
);
|
);
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
|
["OCO_GITPUSH" /* OCO_GITPUSH */](value) {
|
||||||
|
validateConfig(
|
||||||
|
"OCO_GITPUSH" /* OCO_GITPUSH */,
|
||||||
|
typeof value === "boolean",
|
||||||
|
"Must be true or false"
|
||||||
|
);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
["OCO_AI_PROVIDER" /* OCO_AI_PROVIDER */](value) {
|
["OCO_AI_PROVIDER" /* OCO_AI_PROVIDER */](value) {
|
||||||
validateConfig(
|
validateConfig(
|
||||||
"OCO_AI_PROVIDER" /* OCO_AI_PROVIDER */,
|
"OCO_AI_PROVIDER" /* OCO_AI_PROVIDER */,
|
||||||
@@ -18814,6 +18823,7 @@ var getConfig = () => {
|
|||||||
OCO_MESSAGE_TEMPLATE_PLACEHOLDER: process.env.OCO_MESSAGE_TEMPLATE_PLACEHOLDER || "$msg",
|
OCO_MESSAGE_TEMPLATE_PLACEHOLDER: process.env.OCO_MESSAGE_TEMPLATE_PLACEHOLDER || "$msg",
|
||||||
OCO_PROMPT_MODULE: process.env.OCO_PROMPT_MODULE || "conventional-commit",
|
OCO_PROMPT_MODULE: process.env.OCO_PROMPT_MODULE || "conventional-commit",
|
||||||
OCO_AI_PROVIDER: process.env.OCO_AI_PROVIDER || "openai",
|
OCO_AI_PROVIDER: process.env.OCO_AI_PROVIDER || "openai",
|
||||||
|
OCO_GITPUSH: process.env.OCO_GITPUSH === "false" ? false : true,
|
||||||
OCO_ONE_LINE_COMMIT: process.env.OCO_ONE_LINE_COMMIT === "true" ? true : false
|
OCO_ONE_LINE_COMMIT: process.env.OCO_ONE_LINE_COMMIT === "true" ? true : false
|
||||||
};
|
};
|
||||||
const configExists = (0, import_fs.existsSync)(configPath);
|
const configExists = (0, import_fs.existsSync)(configPath);
|
||||||
@@ -18822,7 +18832,7 @@ var getConfig = () => {
|
|||||||
const configFile = (0, import_fs.readFileSync)(configPath, "utf8");
|
const configFile = (0, import_fs.readFileSync)(configPath, "utf8");
|
||||||
const config8 = (0, import_ini.parse)(configFile);
|
const config8 = (0, import_ini.parse)(configFile);
|
||||||
for (const configKey of Object.keys(config8)) {
|
for (const configKey of Object.keys(config8)) {
|
||||||
if (!config8[configKey] || ["null", "undefined"].includes(config8[configKey])) {
|
if (["null", "undefined"].includes(config8[configKey])) {
|
||||||
config8[configKey] = void 0;
|
config8[configKey] = void 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -22472,13 +22482,15 @@ ${source_default.grey("\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2
|
|||||||
ce(`${source_default.green("\u2714")} Successfully committed`);
|
ce(`${source_default.green("\u2714")} Successfully committed`);
|
||||||
ce(stdout);
|
ce(stdout);
|
||||||
const remotes = await getGitRemotes();
|
const remotes = await getGitRemotes();
|
||||||
|
if (config7?.OCO_GITPUSH === false)
|
||||||
|
return;
|
||||||
if (!remotes.length) {
|
if (!remotes.length) {
|
||||||
const { stdout: stdout2 } = await execa("git", ["push"]);
|
const { stdout: stdout2 } = await execa("git", ["push"]);
|
||||||
if (stdout2)
|
if (stdout2)
|
||||||
ce(stdout2);
|
ce(stdout2);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
if (remotes.length === 1) {
|
if (remotes.length === 1 && config7?.OCO_GITPUSH !== true) {
|
||||||
const isPushConfirmedByUser = await Q3({
|
const isPushConfirmedByUser = await Q3({
|
||||||
message: "Do you want to run `git push`?"
|
message: "Do you want to run `git push`?"
|
||||||
});
|
});
|
||||||
|
|||||||
+14
-4
@@ -24244,10 +24244,11 @@ var configValidators = {
|
|||||||
"gpt-3.5-turbo-0125",
|
"gpt-3.5-turbo-0125",
|
||||||
"gpt-4",
|
"gpt-4",
|
||||||
"gpt-4-1106-preview",
|
"gpt-4-1106-preview",
|
||||||
"gpt-4-turbo-preview",
|
"gpt-4-0125-preview",
|
||||||
"gpt-4-0125-preview"
|
"gpt-4-turbo",
|
||||||
|
"gpt-4-turbo-preview"
|
||||||
].includes(value),
|
].includes(value),
|
||||||
`${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'`
|
`${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'`
|
||||||
);
|
);
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
@@ -24267,6 +24268,14 @@ var configValidators = {
|
|||||||
);
|
);
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
|
["OCO_GITPUSH" /* OCO_GITPUSH */](value) {
|
||||||
|
validateConfig(
|
||||||
|
"OCO_GITPUSH" /* OCO_GITPUSH */,
|
||||||
|
typeof value === "boolean",
|
||||||
|
"Must be true or false"
|
||||||
|
);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
["OCO_AI_PROVIDER" /* OCO_AI_PROVIDER */](value) {
|
["OCO_AI_PROVIDER" /* OCO_AI_PROVIDER */](value) {
|
||||||
validateConfig(
|
validateConfig(
|
||||||
"OCO_AI_PROVIDER" /* OCO_AI_PROVIDER */,
|
"OCO_AI_PROVIDER" /* OCO_AI_PROVIDER */,
|
||||||
@@ -24303,6 +24312,7 @@ var getConfig = () => {
|
|||||||
OCO_MESSAGE_TEMPLATE_PLACEHOLDER: process.env.OCO_MESSAGE_TEMPLATE_PLACEHOLDER || "$msg",
|
OCO_MESSAGE_TEMPLATE_PLACEHOLDER: process.env.OCO_MESSAGE_TEMPLATE_PLACEHOLDER || "$msg",
|
||||||
OCO_PROMPT_MODULE: process.env.OCO_PROMPT_MODULE || "conventional-commit",
|
OCO_PROMPT_MODULE: process.env.OCO_PROMPT_MODULE || "conventional-commit",
|
||||||
OCO_AI_PROVIDER: process.env.OCO_AI_PROVIDER || "openai",
|
OCO_AI_PROVIDER: process.env.OCO_AI_PROVIDER || "openai",
|
||||||
|
OCO_GITPUSH: process.env.OCO_GITPUSH === "false" ? false : true,
|
||||||
OCO_ONE_LINE_COMMIT: process.env.OCO_ONE_LINE_COMMIT === "true" ? true : false
|
OCO_ONE_LINE_COMMIT: process.env.OCO_ONE_LINE_COMMIT === "true" ? true : false
|
||||||
};
|
};
|
||||||
const configExists = (0, import_fs.existsSync)(configPath);
|
const configExists = (0, import_fs.existsSync)(configPath);
|
||||||
@@ -24311,7 +24321,7 @@ var getConfig = () => {
|
|||||||
const configFile = (0, import_fs.readFileSync)(configPath, "utf8");
|
const configFile = (0, import_fs.readFileSync)(configPath, "utf8");
|
||||||
const config7 = (0, import_ini.parse)(configFile);
|
const config7 = (0, import_ini.parse)(configFile);
|
||||||
for (const configKey of Object.keys(config7)) {
|
for (const configKey of Object.keys(config7)) {
|
||||||
if (!config7[configKey] || ["null", "undefined"].includes(config7[configKey])) {
|
if (["null", "undefined"].includes(config7[configKey])) {
|
||||||
config7[configKey] = void 0;
|
config7[configKey] = void 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ it('cli flow to generate commit message for 1 new file (staged)', async () => {
|
|||||||
expect(await findByText('Confirm the commit message?')).toBeInTheConsole();
|
expect(await findByText('Confirm the commit message?')).toBeInTheConsole();
|
||||||
userEvent.keyboard('[Enter]');
|
userEvent.keyboard('[Enter]');
|
||||||
|
|
||||||
expect(await findByText('Do you want to run `git push`?')).toBeInTheConsole();
|
expect(await findByText('Choose a remote to push to')).toBeInTheConsole();
|
||||||
userEvent.keyboard('[Enter]');
|
userEvent.keyboard('[Enter]');
|
||||||
|
|
||||||
expect(await findByText('Successfully pushed all commits to origin')).toBeInTheConsole();
|
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
|
|||||||
|
|
||||||
expect(await findByText('Successfully committed')).toBeInTheConsole();
|
expect(await findByText('Successfully committed')).toBeInTheConsole();
|
||||||
|
|
||||||
expect(await findByText('Do you want to run `git push`?')).toBeInTheConsole();
|
expect(await findByText('Choose a remote to push to')).toBeInTheConsole();
|
||||||
userEvent.keyboard('[Enter]');
|
userEvent.keyboard('[Enter]');
|
||||||
|
|
||||||
expect(await findByText('Successfully pushed all commits to origin')).toBeInTheConsole();
|
expect(await findByText('Successfully pushed all commits to origin')).toBeInTheConsole();
|
||||||
|
|||||||
Reference in New Issue
Block a user