Skip to content

Conversation

@alpha912
Copy link
Contributor

Summary

  • add diffDocs to compare OSF documents
  • output detailed differences in osf diff
  • check diff output in CLI tests

Testing

  • pnpm test

https://chatgpt.com/codex/tasks/task_e_685d3ac92b24832bae9bd15b7c6c0a1f

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Error Handling Fails When Command Succeeds

The test's error handling is flawed. If execSync unexpectedly succeeds (i.e., does not throw), the test manually throws an Error('diff should fail'). The catch block then attempts to access err.stdout on this manually thrown Error object, which lacks a stdout property. This leads to misleading test failures, as assertions on output (derived from err.stdout) will fail instead of clearly indicating that the diff command unexpectedly succeeded.

cli/tests/cli.test.ts#L255-L262

try {
execSync(`node "${CLI_PATH}" diff "${testFile}" "${testFile2}"`, { encoding: 'utf8' });
throw new Error('diff should fail');
} catch (err: any) {
const output = (err.stdout || '') as string;
expect(output).toContain('❌ Documents differ');
expect(output).toContain('title');

Fix in Cursor


Comment bugbot run to trigger another review on this PR
Was this report helpful? Give feedback by reacting with 👍 or 👎

alpha912 added 5 commits June 27, 2025 23:08
- Enhanced the test for the CLI diff command to provide clearer failure messages when the command unexpectedly succeeds.
- Added checks to ensure that output is only validated if an actual error occurs, improving robustness of the test.
- This change ensures that the test accurately reflects the expected behavior when comparing different files.

## Testing
- Run `npm test` to verify that the updated tests function correctly.
- Modified the CI/CD workflow to trigger on pushes to branches matching the pattern 'codex/**', in addition to 'main' and 'develop'.
- This change allows for better integration and testing of features developed in the 'codex' namespace.

## Testing
- Ensure the CI/CD pipeline runs successfully on the specified branches.
- Rename eslint.config.js to eslint.config.mjs for ES6 imports
- Add @eslint/js dependency for ESLint 9 compatibility
- Configure proper ignores for dist/, node_modules/, coverage/, and .d.ts files
- Add Node.js globals (console, process, __dirname, etc.)
- Relax strict rules to warnings for existing codebase
- Update pnpm-lock.yaml for new dependencies
@alpha912 alpha912 merged commit ce80f34 into main Jun 27, 2025
30 checks passed
@alpha912 alpha912 deleted the codex/implement-diff-command-handler-logic branch June 27, 2025 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants