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

fix: file write errors for tools and newsroom video #3297

Merged
merged 7 commits into from
Oct 26, 2024

Conversation

vishvamsinh28
Copy link
Contributor

@vishvamsinh28 vishvamsinh28 commented Oct 16, 2024

This PR replaces resolve with path.join for paths in build-tools script and its test

Summary by CodeRabbit

  • Chores
    • Enhanced error handling and directory management in build tools and tests.
    • Updated file handling to utilize fs-extra for improved file system operations.
    • Modified test setup to ensure directories are created and cleaned up correctly, preventing errors.

Copy link

netlify bot commented Oct 16, 2024

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 8385d7c
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/671d3193e8a33100087dbdf3
😎 Deploy Preview https://deploy-preview-3297--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Oct 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.32%. Comparing base (6ae313d) to head (8385d7c).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3297   +/-   ##
=======================================
  Coverage   47.32%   47.32%           
=======================================
  Files          22       22           
  Lines         672      672           
=======================================
  Hits          318      318           
  Misses        354      354           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@asyncapi-bot
Copy link
Contributor

asyncapi-bot commented Oct 16, 2024

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 44
🟢 Accessibility 98
🟢 Best practices 92
🟢 SEO 100
🔴 PWA 33

Lighthouse ran on https://deploy-preview-3297--asyncapi-website.netlify.app/

Comment on lines 25 to 28
const automatedToolsPath = resolve(__dirname, '../config', 'tools-automated.json');
const manualToolsPath = resolve(__dirname, '../config', 'tools-manual.json');
const toolsPath = resolve(__dirname, '../config', 'tools.json');
const tagsPath = resolve(__dirname, '../config', 'all-tags.json');
Copy link
Member

Choose a reason for hiding this comment

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

Why has resolve worked previously? I saw tests or scripts aren't failing even with resolve

Copy link
Contributor Author

@vishvamsinh28 vishvamsinh28 Oct 17, 2024

Choose a reason for hiding this comment

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

I thought the same we dont need this change, the workflow was initially failing on Windows, so I researched it and found that it might be due to path errors. I came across a solution suggesting the use of path.join, which should work across all OS and it passed all the checks. However, it's now failing on Ubuntu as well, and I think the issue might be with the fs module, which is causing the workflow to fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should i close this PR ?

Copy link
Member

Choose a reason for hiding this comment

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

Don't close it but try to identify the root cause of that issue and push the changes

Copy link
Contributor

coderabbitai bot commented Oct 19, 2024

Walkthrough

The changes involve updating file handling in several scripts by switching from the native fs module to fs-extra, which provides enhanced file system capabilities. The asynchronous method fs.writeFile replaces the synchronous fs.writeFileSync, improving control flow. Test files are also modified to reflect these changes, ensuring robust error handling and directory management. Additionally, a new dependency on fs-extra is added to package.json.

Changes

File Change Summary
scripts/build-tools.js Changed file system module to fs-extra, updated buildTools method to use fs.writeFile asynchronously.
scripts/build-newsroom-videos.js Updated import to fs-extra, modified logging, and ensured asynchronous file writing with fs.writeFile.
tests/build-tools.test.js Updated to use fs-extra, enhanced error handling, and modified directory path resolution for tests.
tests/build-newsroom-videos.test.js Changed to fs-extra, improved directory management in test setup and teardown.
package.json Added dependency on fs-extra with version ^11.2.0.

Possibly related PRs

Suggested labels

ready-to-merge, autoapproved, autoupdate

Suggested reviewers

  • derberg
  • magicmatatjahu
  • Mayaleeeee
  • asyncapi-bot-eve
  • devilkiller-ag
  • sambhavgupta0705
  • akshatnema

🐇 In the land of code where paths align,
We join them together, oh so fine!
With tools in hand and tests to run,
Our build process shines, oh what fun!
So hop along, let’s make it right,
For every path we join brings delight! 🌟


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?

❤️ Share
🪧 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 @coderabbitai in 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 @coderabbitai in 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 pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
tests/build-tools.test.js (2)

81-81: Good use of path.join() for the invalid path.

The change to path.join() is consistent with earlier modifications and appropriate for constructing an invalid path.

Consider adding a comment explaining the purpose of this invalid path for improved code readability:

-        const invalidPath = path.join('/invalid_dir', 'tools.json');
+        // Create an invalid path to test file write errors
+        const invalidPath = path.join('/invalid_dir', 'tools.json');

Line range hint 1-89: Consider adding tests for path handling.

The changes to use path.join() consistently improve the portability of the tests. However, to ensure robustness, consider adding specific tests for path handling:

  1. Test with paths containing different separators (forward slash, backslash) to verify cross-platform compatibility.
  2. Test with relative and absolute paths to ensure correct behavior in various scenarios.
  3. Test with empty path segments to verify proper handling of edge cases.

These additional tests would help validate the new path joining logic across different environments.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 9a1c3a6 and 8003bff.

📒 Files selected for processing (2)
  • scripts/build-tools.js (2 hunks)
  • tests/build-tools.test.js (3 hunks)
🧰 Additional context used
🔇 Additional comments (6)
scripts/build-tools.js (4)

Line range hint 8-22: LGTM: Function logic remains sound and unchanged.

The buildTools function maintains its correct implementation, including proper error handling and asynchronous operations. The function signature addition in the summary likely reflects changes in the module's export structure rather than modifications to the function itself.


25-28: Improved cross-platform compatibility with path.join()

The change from path.resolve() to path.join() is a good step towards ensuring better cross-platform compatibility, especially for Windows systems. This modification aligns with the intention mentioned in the previous comments to address path-related issues.


25-28: Further investigation needed for build failures

While the change to path.join() is a step in the right direction for cross-platform compatibility, the persistence of issues on Ubuntu (as mentioned in the past comments) suggests that there might be underlying problems beyond path resolution.

Consider the following steps:

  1. Verify if the build process is still failing on both Windows and Ubuntu with these changes.
  2. If failures persist, investigate other potential causes, such as issues with the fs module or other aspects of the build process.
  3. Consider adding more detailed error logging to pinpoint the exact cause of failures.

To help diagnose the issue, you can add more detailed logging to the buildTools function. Here's a script to modify the file:

#!/bin/bash
# Description: Add detailed logging to buildTools function

# Test: Add logging statements to buildTools function
sed -i '9i\    console.log(`Starting buildTools with paths:`);\n    console.log(`automatedToolsPath: ${automatedToolsPath}`);\n    console.log(`manualToolsPath: ${manualToolsPath}`);\n    console.log(`toolsPath: ${toolsPath}`);\n    console.log(`tagsPath: ${tagsPath}`);' scripts/build-tools.js

sed -i '14i\    console.log(`GitHub extract data retrieved. Length: ${githubExtractData.length}`);' scripts/build-tools.js

sed -i '16i\    console.log(`Automated tools converted. Count: ${Object.keys(automatedTools).length}`);' scripts/build-tools.js

sed -i '21i\    console.log(`Combined tools written to file: ${toolsPath}`);' scripts/build-tools.js

sed -i '23i\    console.log(`Build tools process completed successfully.`);' scripts/build-tools.js

# Display the changes
diff scripts/build-tools.js <(git show HEAD:scripts/build-tools.js)

This script adds logging statements to help identify where the process might be failing. After applying these changes, run the build process again and analyze the logs to identify the root cause of any persistent issues.


25-28: Verify path resolution behavior

While path.join() improves cross-platform compatibility, it's important to note that it behaves differently from path.resolve(). Specifically:

  1. join() concatenates path segments, while resolve() resolves to an absolute path.
  2. resolve() processes segments from right to left, while join() goes left to right.

Please verify that these changes don't inadvertently affect the expected path resolution in your application.

To help verify the path resolution, you can run the following script:

This script will help you compare the outputs of path.join() and path.resolve() for the modified paths, allowing you to ensure that the change doesn't introduce any unexpected behavior.

tests/build-tools.test.js (2)

2-2: LGTM: Correct import of the path module.

The path module is correctly imported, which is essential for the path.join() function used throughout the file.


27-31: Excellent use of path.join() for constructing file paths.

The change from path.resolve() to path.join() is a good improvement:

  1. It's more appropriate for joining path segments without resolving to absolute paths.
  2. It maintains consistency across all path definitions.
  3. Using __dirname ensures paths are relative to the current directory, which is a best practice.

This change enhances the portability and reliability of the test suite across different environments.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Outside diff range and nitpick comments (4)
scripts/build-tools.js (1)

11-18: LGTM: Improved file writing process with directory check and retry mechanism.

The changes address the path-related issues mentioned in previous comments and add resilience to the file writing process. The directory check before writing is a good practice.

Consider adding a comment explaining the purpose of the retryWriteFile function for better code documentation.

 const automatedDir = dirname(automatedToolsPath);

 if (!fs.existsSync(automatedDir)) {
   fs.mkdirSync(automatedDir, { recursive: true });
 }

+ // Use retryWriteFile to handle potential ENOENT errors and improve reliability
 await retryWriteFile(automatedToolsPath, JSON.stringify(automatedTools, null, '  '));
tests/build-newsroom-videos.test.js (2)

18-20: Good improvement in cleanup logic

The addition of the existence check before removing the test directory is a good practice. It prevents potential errors when trying to remove a non-existent directory.

Consider using fs.promises.rm for asynchronous directory removal, which is generally preferred in Node.js for better performance:

afterAll(async () => {
  if (existsSync(testDir)) {
    await fs.promises.rm(testDir, { recursive: true, force: true });
  }
});

24-26: Good addition for test setup reliability

The conditional creation of the test directory in the beforeEach hook is a good practice. It ensures that the directory exists before each test, preventing potential errors.

Consider using fs.promises.mkdir for asynchronous directory creation:

beforeEach(async () => {
  await fs.promises.mkdir(testDir, { recursive: true });
  fetch.mockClear();
});

This approach is more idiomatic in modern Node.js and can help with performance in larger test suites.

scripts/build-newsroom-videos.js (1)

60-60: Rename resolve in the Promise to avoid shadowing

The parameter resolve in your Promise executor may shadow the resolve function imported from the path module. This can cause confusion or unexpected behavior.

Rename the parameter to avoid shadowing:

-                await new Promise((resolve) => setTimeout(resolve, delay));
+                await new Promise((res) => setTimeout(res, delay));
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 58-60: scripts/build-newsroom-videos.js#L58-L60
Added lines #L58 - L60 were not covered by tests

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 8003bff and b80925c.

📒 Files selected for processing (4)
  • scripts/build-newsroom-videos.js (2 hunks)
  • scripts/build-tools.js (1 hunks)
  • tests/build-newsroom-videos.test.js (4 hunks)
  • tests/build-tools.test.js (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/build-tools.test.js
🧰 Additional context used
🪛 GitHub Check: codecov/patch
scripts/build-newsroom-videos.js

[warning] 58-60: scripts/build-newsroom-videos.js#L58-L60
Added lines #L58 - L60 were not covered by tests


[warning] 62-62: scripts/build-newsroom-videos.js#L62
Added line #L62 was not covered by tests

scripts/build-tools.js

[warning] 33-35: scripts/build-tools.js#L33-L35
Added lines #L33 - L35 were not covered by tests


[warning] 37-37: scripts/build-tools.js#L37
Added line #L37 was not covered by tests

🔇 Additional comments (6)
scripts/build-tools.js (3)

5-5: LGTM: Import of dirname is appropriate.

The addition of dirname from the path module is consistent with its usage in the modified buildTools function. This change is necessary and correct.


Line range hint 1-41: Overall: Good improvements to file writing reliability and cross-platform compatibility.

The changes in this file effectively address the issues mentioned in previous comments regarding path handling across different operating systems. The introduction of the retryWriteFile function and the directory existence check improve the reliability of file writing operations.

Key points:

  1. The use of path.dirname and directory checks addresses potential ENOENT errors.
  2. The new retryWriteFile function adds resilience to file writing operations.
  3. Consider adding more documentation and improving test coverage as suggested in previous comments.

These changes contribute positively to the overall robustness of the build tools script.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 33-35: scripts/build-tools.js#L33-L35
Added lines #L33 - L35 were not covered by tests


[warning] 37-37: scripts/build-tools.js#L37
Added line #L37 was not covered by tests


26-41: LGTM: Well-implemented retry mechanism for file writing.

The retryWriteFile function is a good addition to handle transient file system issues. It correctly implements a retry mechanism with appropriate error handling for ENOENT errors.

Suggestions for improvement:

  1. Consider logging or throwing an error if all retry attempts fail.
  2. The static analysis tool indicates that some lines are not covered by tests. Consider adding test cases to cover these scenarios.

To address the code coverage issue, let's verify the existing test coverage:

Would you like assistance in generating additional test cases to improve coverage for the retryWriteFile function?

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 33-35: scripts/build-tools.js#L33-L35
Added lines #L33 - L35 were not covered by tests


[warning] 37-37: scripts/build-tools.js#L37
Added line #L37 was not covered by tests

tests/build-newsroom-videos.test.js (3)

1-1: LGTM: Improved import for better directory handling

The addition of existsSync from the fs module is a good improvement. It allows for more robust directory existence checks throughout the test file, enhancing error handling and test reliability.


52-52: LGTM: Improved readability

The addition of this empty line improves the readability of the test by clearly separating the API call expectations from the file content assertions.


Line range hint 1-95: Overall assessment: Good improvements with minor suggestions

The changes in this file generally improve error handling and test reliability, particularly in managing the test directory. The addition of existsSync checks and the use of mkdirSync with the recursive option are good practices.

Key points:

  1. The import changes and directory existence checks in afterAll and beforeEach hooks are well-implemented.
  2. There's a redundant directory check in the first test case that should be removed.
  3. Consider using fs.promises methods for asynchronous file system operations, which is more idiomatic in modern Node.js.

These changes enhance the robustness of the tests, but there's room for minor improvements as noted in the individual comments.

Comment on lines 36 to 39
if (!existsSync(testDir)) {
mkdirSync(testDir, { recursive: true });
}

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove redundant directory check

The directory existence check and creation here is redundant with the one in the beforeEach hook. Since beforeEach runs before every test, including this one, the directory will always exist at this point.

Remove these lines to avoid unnecessary checks:

-        if (!existsSync(testDir)) {
-            mkdirSync(testDir, { recursive: true });
-        }
-

This will simplify the test and improve its readability without affecting its functionality.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (!existsSync(testDir)) {
mkdirSync(testDir, { recursive: true });
}

Comment on lines 58 to 62
if (err.code === 'ENOENT') {
console.error(`ENOENT error on attempt ${attempt + 1}. Retrying in ${delay}ms...`);
await new Promise((resolve) => setTimeout(resolve, delay));
} else {
throw err;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add tests to cover error handling in retryWriteFile

The error handling paths, specifically when catching ENOENT errors and other exceptions, are not currently covered by tests. Ensuring these paths are tested will improve the reliability of your code.

Consider adding unit tests that simulate ENOENT and other errors to verify the retry logic works as expected. Would you like assistance in writing these tests or should I open a new GitHub issue to track this task?

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 58-60: scripts/build-newsroom-videos.js#L58-L60
Added lines #L58 - L60 were not covered by tests


[warning] 62-62: scripts/build-newsroom-videos.js#L62
Added line #L62 was not covered by tests

async function retryWriteFile(filePath, data, retries = 3, delay = 1000) {
for (let attempt = 0; attempt < retries; attempt++) {
try {
writeFileSync(filePath, data);
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Use asynchronous writeFile instead of writeFileSync

Using writeFileSync in an asynchronous function can block the event loop, negating the benefits of asynchronous code. Consider using fs.promises.writeFile to perform the file write operation asynchronously.

Apply this change to use the asynchronous writeFile:

-            writeFileSync(filePath, data);
+            await fs.promises.writeFile(filePath, data);

Update your imports to include fs.promises:

-const { writeFileSync, mkdirSync, existsSync } = require('fs');
+const { mkdirSync, existsSync, promises: fsPromises } = require('fs');

And modify the code accordingly:

+            await fsPromises.writeFile(filePath, data);

Committable suggestion was skipped due to low confidence.

}
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Throw an error if all retries fail in retryWriteFile

If all retry attempts fail, the function currently exits silently without throwing an error. This can lead to unhandled exceptions upstream. It's important to notify the calling function of the failure.

Add an error throw after the retry loop:

    }
+   throw new Error(`Failed to write file to ${filePath} after ${retries} attempts.`);
}

Committable suggestion was skipped due to low confidence.

@vishvamsinh28 vishvamsinh28 changed the title feat: update path in build-tools fix: file write errors for tools and newsroom video Oct 19, 2024
@anshgoyalevil
Copy link
Member

@vishvamsinh28 Kindly explain what exactly you changed with this PR.

@vishvamsinh28
Copy link
Contributor Author

@anshgoyalevil I replaced the fs module with fs-extra to fix the issue.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between b80925c and 8385d7c.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • package.json (1 hunks)
  • scripts/build-newsroom-videos.js (2 hunks)
  • scripts/build-tools.js (1 hunks)
  • tests/build-newsroom-videos.test.js (2 hunks)
  • tests/build-tools.test.js (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • scripts/build-newsroom-videos.js
  • scripts/build-tools.js
  • tests/build-newsroom-videos.test.js
  • tests/build-tools.test.js

@@ -70,6 +70,7 @@
"clsx": "^2.1.0",
"cssnano": "^6.0.3",
"dotenv": "^16.4.4",
"fs-extra": "^11.2.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Native fs module is still widely used - migration to fs-extra is incomplete

The codebase shows inconsistent usage of file system modules:

  • fs-extra is only used in 4 files: build-tools.js, build-tools.test.js, build-newsroom-videos.js, and build-newsroom-videos.test.js
  • 19 other files still use the native fs module

Since the PR's objective was to switch from native fs to fs-extra for better error handling and async operations, the migration appears to be incomplete. The changes should be consistent across the codebase to:

  • Leverage fs-extra's enhanced features uniformly
  • Maintain consistent error handling patterns
  • Avoid mixing different file operation paradigms
🔗 Analysis chain

LGTM! Consider adding @types/fs-extra for TypeScript support.

The addition of fs-extra is appropriate for enhanced file system operations and better error handling. Since this project uses TypeScript, consider adding @types/fs-extra to devDependencies for improved type safety.

Let's verify the fs-extra usage across the codebase:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify fs-extra is properly imported and used instead of native fs

# Test 1: Check if native 'fs' is still being imported
echo "Checking for native fs imports..."
rg "require\(['\"]fs['\"]\)" || rg "from ['\"]fs['\"]\""

# Test 2: Verify fs-extra usage
echo "Checking fs-extra usage..."
rg "require\(['\"]fs-extra['\"]\)" || rg "from ['\"]fs-extra['\"]\""

Length of output: 1781


jest.mock('node-fetch-2', () => jest.fn());

describe('buildNewsroomVideos', () => {
const testDir = resolve(__dirname, 'test_config');
const testDir = join(os.tmpdir(), 'test_config');
Copy link
Member

Choose a reason for hiding this comment

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

This is a nice addition. We should use os.tmpDir() for other scripts as well where a temp folder was being created inside the website directory.

@anshgoyalevil
Copy link
Member

/rtm

@asyncapi-bot asyncapi-bot merged commit 0cc300d into asyncapi:master Oct 26, 2024
23 checks passed
@anshgoyalevil anshgoyalevil added the gsoc This label should be used for issues or discussions related to ideas for Google Summer of Code label Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gsoc This label should be used for issues or discussions related to ideas for Google Summer of Code ready-to-merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants