Skip to content

Commit ec307d5

Browse files
di-sukharevmatscubeMoret84YOwatarimetavind
authored
3.0.14 (#333)
* test: ✅ add the first E2E test and configuration to CI (#316) * add tests * Add push config (#220) * feat: add instructions and support for configuring gpt-4-turbo (#320) * 3.0.12 * build * feat: add 'gpt-4-turbo' to supported models in README and config validation --------- Co-authored-by: di-sukharev <[email protected]> * ✅ 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 * Feat: Add Claude 3 support (#318) * 3.0.12 * build * feat: anthropic claude 3 support * fix: add system prompt * fix: type check * fix: package version * fix: update anthropic for dependency bug fix * feat: update build files * feat: update version number --------- Co-authored-by: di-sukharev <[email protected]> * 🐛bug fix: enable to use the new format of OpenAI's project API Key (#328) * fix(config.ts): remove validation for OCO_OPENAI_API_KEY length to accommodate variable key lengths * build * ♻️ refactor(config.ts): Addition of UnitTest environment and unittest for commands/config.ts#getConfig (#330) * feat(jest.config.ts): update jest preset for TS ESM support and ignore patterns feat(package.json): add test:unit script with NODE_OPTIONS for ESM refactor(src/commands/config.ts): improve dotenv usage with dynamic paths feat(src/commands/config.ts): allow custom config and env paths in getConfig refactor(src/commands/config.ts): streamline environment variable access feat(test/unit): add unit tests for config handling and utility functions - Implement unit tests for `getConfig` function to ensure correct behavior in various scenarios including default values, global config, and local env file precedence. - Add utility function `prepareFile` for creating temporary files during tests, facilitating testing of file-based configurations. * feat(e2e.yml): add unit-test job to GitHub Actions for running unit tests on pull requests * ci(test.yml): add GitHub Actions workflow for unit and e2e tests on pull requests * refactor(config.ts): streamline environment variable access using process.env directly test(config.test.ts): add setup and teardown for environment variables in tests to ensure test isolation * feat(package.json): add `test:all` script to run all tests in Docker refactor(package.json): consolidate Docker build steps into `test:docker-build` script for DRY principle fix(package.json): ensure `test:unit:docker` and `test:e2e:docker` scripts use the same Docker image and remove container after run chore(test/Dockerfile): remove default CMD to allow dynamic test script execution in Docker * refactor(config.test.ts): anonymize API keys in tests for better security practices * feat(config.test.ts): add tests for OCO_ANTHROPIC_API_KEY configuration * refactor(config.ts): streamline path imports and remove unused DotenvParseOutput - Simplify path module imports by removing default import and using named imports for `pathJoin` and `pathResolve`. - Remove unused `DotenvParseOutput` import to clean up the code. * refactor(config.test.ts): simplify API key mock values for clarity in tests * test(config.test.ts): remove tests for default config values and redundant cases - Removed tests that checked for default config values when no config or env files are present, as these scenarios are now handled differently. - Eliminated tests for empty global config and local env files to streamline testing focus on actual config loading logic. - Removed test for prioritizing local env over global config due to changes in config loading strategy, simplifying the configuration management. * new version --------- Co-authored-by: Takanori Matsumoto <[email protected]> Co-authored-by: Moret84 <[email protected]> Co-authored-by: yowatari <[email protected]> Co-authored-by: metavind <[email protected]>
1 parent 0ac7211 commit ec307d5

23 files changed

+69168
-24431
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.env

.github/workflows/test.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Testing
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
unit-test:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
node-version: [20.x]
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Use Node.js ${{ matrix.node-version }}
14+
uses: actions/setup-node@v2
15+
with:
16+
node-version: ${{ matrix.node-version }}
17+
- name: Install dependencies
18+
run: npm install
19+
- name: Run Unit Tests
20+
run: npm run test:unit
21+
e2e-test:
22+
runs-on: ubuntu-latest
23+
strategy:
24+
matrix:
25+
node-version: [20.x]
26+
steps:
27+
- uses: actions/checkout@v2
28+
- name: Use Node.js ${{ matrix.node-version }}
29+
uses: actions/setup-node@v2
30+
with:
31+
node-version: ${{ matrix.node-version }}
32+
- name: Install git
33+
run: |
34+
sudo apt-get update
35+
sudo apt-get install -y git
36+
git --version
37+
- name: Setup git
38+
run: |
39+
git config --global user.email "[email protected]"
40+
git config --global user.name "Test User"
41+
- name: Install dependencies
42+
run: npm install
43+
- name: Build
44+
run: npm run build
45+
- name: Run E2E Tests
46+
run: npm run test:e2e

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ OCO_TOKENS_MAX_OUTPUT=<max response tokens (default: 500)>
9797
OCO_OPENAI_BASE_PATH=<may be used to set proxy path to OpenAI api>
9898
OCO_DESCRIPTION=<postface a message with ~3 sentences description of the changes>
9999
OCO_EMOJI=<boolean, add GitMoji>
100-
OCO_MODEL=<either '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'>
100+
OCO_MODEL=<either 'gpt-4', 'gpt-4-turbo', 'gpt-3.5-turbo' (default), 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-turbo-preview' or 'gpt-4-0125-preview'>
101101
OCO_LANGUAGE=<locale, scroll to the bottom to see options>
102102
OCO_MESSAGE_TEMPLATE_PLACEHOLDER=<message template placeholder, default: '$msg'>
103103
OCO_PROMPT_MODULE=<either conventional-commit or @commitlint, default: conventional-commit>
@@ -169,6 +169,14 @@ oco config set OCO_LANGUAGE=française
169169
The default language setting is **English**
170170
All available languages are currently listed in the [i18n](https://github.com/di-sukharev/opencommit/tree/master/src/i18n) folder
171171

172+
### Push to git
173+
174+
Pushing to git is on by default but if you would like to turn it off just use:
175+
176+
```sh
177+
oc config set OCO_GITPUSH=false
178+
```
179+
172180
### Switch to `@commitlint`
173181

174182
OpenCommit allows you to choose the prompt module used to generate commit messages. By default, OpenCommit uses its conventional-commit message generator. However, you can switch to using the `@commitlint` prompt module if you prefer. This option lets you generate commit messages in respect with the local config.

jest.config.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* For a detailed explanation regarding each configuration property, visit:
3+
* https://jestjs.io/docs/configuration
4+
*/
5+
6+
import type { Config } from 'jest';
7+
8+
const config: Config = {
9+
testTimeout: 100_000,
10+
coverageProvider: 'v8',
11+
moduleDirectories: ['node_modules', 'src'],
12+
preset: 'ts-jest/presets/js-with-ts-esm',
13+
setupFilesAfterEnv: ['<rootDir>/test/jest-setup.ts'],
14+
testEnvironment: 'node',
15+
testRegex: ['.*\\.test\\.ts$'],
16+
transformIgnorePatterns: ['node_modules/(?!cli-testing-library)'],
17+
transform: {
18+
'^.+\\.(ts|tsx)$': [
19+
'ts-jest',
20+
{
21+
diagnostics: false,
22+
useESM: true
23+
}
24+
]
25+
}
26+
};
27+
28+
export default config;

0 commit comments

Comments
 (0)