Skip to content
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

390 add config set tests #399

Merged
merged 4 commits into from
Sep 1, 2024
Merged

390 add config set tests #399

merged 4 commits into from
Sep 1, 2024

Conversation

di-sukharev
Copy link
Owner

solve #390 and refactor isCancel

…el actions to prevent unintended behavior

refactor(commit.ts): streamline conditional checks for user confirmations to enhance code readability and maintainability
…ency in commit message generation process

fix(commit.ts): ensure proper stopping of spinners in case of errors during commit message generation and committing process
@di-sukharev di-sukharev changed the base branch from master to dev August 30, 2024 11:40
…better maintainability and readability

refactor(config.ts): improve initGlobalConfig function to accept a configPath parameter for flexibility
feat(config.ts): enhance getConfig function to support separate paths for global and environment configurations
test(config.test.ts): update tests to reflect changes in config handling and ensure proper functionality
style(utils.ts): clean up code formatting for consistency and readability
style(tsconfig.json): adjust formatting in tsconfig.json for better clarity and maintainability
@di-sukharev
Copy link
Owner Author

@matscube could you review please

@di-sukharev
Copy link
Owner Author

di-sukharev commented Aug 30, 2024

i dont understand why the unit tests fail 🤔

is there a way to show stack trace of where it fails?

@matscube
Copy link
Contributor

@di-sukharev Hi, It seems that an error occurs when the cleanup function is executed for a directory that no longer exists.

For example, cleanup is executed in beforeEach and afterEach, but globalConfigFile / envConfigFile are set to the same path between each test (it) and test (it), so the same directory is cleaned up twice and an error occurs.

  beforeEach(async () => {
    resetEnv(originalEnv);
    if (globalConfigFile) await globalConfigFile.cleanup();
    if (envConfigFile) await envConfigFile.cleanup();
  });

  afterEach(async () => {
    if (globalConfigFile) await globalConfigFile.cleanup();
    if (envConfigFile) await envConfigFile.cleanup();
  });

  describe(...
    it(...
    it(...

It can be fixed by changing the code to execute cleanup only once, but it seems easier to fix by checking the existence of the directory in the cleanup function.

I created a PR on this branch, so please check it out.
#401

… prevent errors if directory does not exist (#401)
@di-sukharev
Copy link
Owner Author

thank you @matscube 🙇

@di-sukharev di-sukharev merged commit 8702c17 into dev Sep 1, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants