-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛Fix: prompt-module/@commitlint #336
base: dev
Are you sure you want to change the base?
Conversation
…nfig loading to support both CJS and ESM modules 💡 (pwd-commitlint.ts): Add detailed comments and error handling for better clarity and robustness in commitlint module loading process
…ies for commitlint configurations 🔧 (setup.sh): Add shell script to set up commitlint configurations for e2e tests
…o define test mock type for testing purposes 📝 (config.ts): Update documentation for OCO_TEST_MOCK_TYPE configuration key in configValidators and getConfig functions 📝 (testAi.ts): Add TEST_MOCK_TYPES constant array to define supported test mock types 📝 (testAi.ts): Update generateCommitMessage function to use OCO_TEST_MOCK_TYPE from config for different test mock types 📝 (commitlint.test.ts): Add e2e test for running "oco commitlint force" with different @commitlint versions using CJS and ESM 📝 (utils.ts): Add wait function to introduce delay in milliseconds for testing purposes
… version parameter for better code organization and readability 📝 (commitlint.test.ts): add test case for commitlint@9 using CJS to ensure proper functionality and compatibility 📝 (commitlint.test.ts): add test case for commitlint@18 using CJS to ensure proper functionality and compatibility 📝 (commitlint.test.ts): add test case for commitlint@19 using ESM to ensure proper functionality and compatibility
… index.ts file before running tests
hi man, please calm down! haha <3 let me know when i can review and merge it |
…port configure style(test/e2e/prompt-module/commitlint.test.ts): add missing semicolon for consistency test(test/e2e/prompt-module/commitlint.test.ts): add e2e tests for @commitlint prompt-module integration
…n accuracy ♻️ (commitlint config): refactor commitlint.config.js to use ES module syntax ✨ (package.json): specify "type": "module" to support ES module syntax
@@ -1,11 +1,31 @@ | |||
import { ChatCompletionRequestMessage } from 'openai'; | |||
import { AiEngine } from './Engine'; | |||
import { getConfig } from '../commands/config'; | |||
|
|||
export const TEST_MOCK_TYPES = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the testing of OCO_PROMPT_MODULE=@commitlint, a TestAi that returns JSON data, not just a string, was needed. Therefore, I added a setting to select the output type of TestAi for testing purposes.
@@ -0,0 +1,11 @@ | |||
#!/bin/sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to conduct E2E tests for OCO_PROMPT_MODULE=@commitlint, it was necessary to prepare an environment where the commitlint package is installed.
- Before running the E2E tests, we create node_modules according to the prepared package-lock.json (by setup.sh),
- We copy the node_modules with commitlint installed into the test environment within the E2E test suite,
- We are testing the commitlint command for each version of node_modules.
@di-sukharev |
Current Issue
OCO_PROMPT_MODULE=@commitlint
functionality is currently not working as expected. The following steps reproduce the issue:npm i @commitlint/cli
commitlint.config.js
OCO_PROMPT_MODULE=@commitlint
oco commitlint force
Identified Problems
src/modules/commitlint/utils.ts#getJSONBlock
consistency
is not defined (a misspelling ofinput
).src/modules/commitlint/pwd-commitlint.ts#getCommitLintPWDConfig
only supports the CJS version of the@commitlint/load
package.@commitlint/load
package usingrequire
. However, commitlint v19 and onwards only support pure ESM.Proposed Changes
OCO_PROMPT_MODULE=@commitlint
functionalitysrc/modules/commitlint/utils.ts#getJSONBlock
.Checklist
git init
npm init
npm install --save-dev @commitlint/{cli,config-conventional}@19.x
)echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
type: module
in package.jsonnpm install --save-dev @commitlint/{cli,config-conventional}@18.x
)echo "module.exports = { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
oco config set OCO_PROMPT_MODULE=@commitlint
oco commitlint force
oco
.opencommit-commitlint
configoco
again