feat: add test for combine tools script
This PR adds test for combine tools script.
Summary by CodeRabbit
-
New Features
- Introduced new tools data structures for testing purposes, enhancing the testing framework.
- Added new entries in JSON files for automated and manual tools, including "Tool A" and "Tool B".
- Enhanced directory handling in various scripts to ensure directories exist before writing files.
- Updated file writing methods to be asynchronous for improved performance.
-
Bug Fixes
- Improved error handling in the
combineToolsfunction to catch exceptions and log validation errors.
- Improved error handling in the
-
Tests
- Implemented a comprehensive suite of unit tests for the
combineToolsfunction to ensure reliability and correctness. - Updated tests to maintain consistency in path construction and enhance robustness in setup and teardown processes.
- Implemented a comprehensive suite of unit tests for the
Deploy Preview for asyncapi-website ready!
Built without sensitive environment variables
| Name | Link |
|---|---|
| Latest commit | 98f3238284329e0ad5290751fca7bd87be6e28b5 |
| Latest deploy log | https://app.netlify.com/sites/asyncapi-website/deploys/67569b9e07c1db0008919172 |
| Deploy Preview | https://deploy-preview-3136--asyncapi-website.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
⚡️ Lighthouse report for the changes in this PR:
| Category | Score |
|---|---|
| 🔴 Performance | 47 |
| 🟢 Accessibility | 98 |
| 🟢 Best practices | 92 |
| 🟢 SEO | 100 |
| 🔴 PWA | 33 |
Lighthouse ran on https://deploy-preview-3136--asyncapi-website.netlify.app/
Walkthrough
The changes in this pull request introduce enhanced error handling to the combineTools function in scripts/tools/combine-tools.js by adding a try-catch block. This modification ensures that exceptions are caught and logged, providing descriptive error messages. Additionally, a new file, combineToolsData.js, is created to export various data structures related to tools. New entries are also added to the JSON files for automated and manual tools, and a comprehensive suite of unit tests is introduced for the combineTools function.
Changes
| File Path | Change Summary |
|---|---|
scripts/tools/combine-tools.js |
Modified combineTools function to include a try-catch block for error handling and logging validation errors. |
tests/fixtures/combineToolsData.js |
Added constants for tools, languages, and technologies, including various categories and attributes of tools. |
tests/fixtures/tools/automated-tools.json |
Introduced a new JSON structure with a category and a tool named "Tool B" with associated filters and a repository URL. |
tests/fixtures/tools/manual-tools.json |
Added a new tool entry "Tool A" with metadata including programming language, technology, and a repository URL. |
tests/tools/combine-tools.test.js |
Introduced unit tests for the combineTools function covering various scenarios, including error handling and validation. |
Possibly related PRs
- #3265: The changes in this PR involve enhancing error handling in the
convertToolsfunction, which is similar to the introduction of atry-catchblock in thecombineToolsfunction in the main PR, indicating a focus on improving error management in tool processing. - #3297: This PR also updates file writing operations to use asynchronous methods, similar to the changes made in the main PR where file operations are included within a
tryblock to ensure they only execute if no errors occur during processing. - #3422: This PR addresses file accessibility issues in tests related to both the build-tools and newsroom video scripts, which aligns with the main PR's focus on improving error handling and ensuring that file operations are executed correctly without errors.
Suggested labels
ready-to-merge
Suggested reviewers
- derberg
- akshatnema
- magicmatatjahu
- sambhavgupta0705
- anshgoyalevil
- Mayaleeeee
- devilkiller-ag
- asyncapi-bot-eve
🐰 In the code, we now take care,
Withtry-catchblocks, no need to despair!
Tools combined with data so bright,
Errors logged, everything feels right.
From "Tool A" to "Tool B," we cheer,
A hop of joy, for changes are here! 🥕
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 77.22%. Comparing base (
cd391cc) to head (98f3238). Report is 1 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #3136 +/- ##
==========================================
+ Coverage 70.18% 77.22% +7.04%
==========================================
Files 21 21
Lines 664 663 -1
==========================================
+ Hits 466 512 +46
+ Misses 198 151 -47
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@vishvamsinh28 You need to check what caused this workflow to fail
Additionally, can we upload base reports for each PR, or does that work as a one time process for a new repo. Kindly research on that and fix
@coderabbitai resolve
:white_check_mark: Actions performed
Comments resolved.
@coderabbitai full review
:white_check_mark: Actions performed
Full review triggered.
@akshatnema applied suggested changes
/rtm