-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Improve i18n Test Output and Add Detailed Logging #2876
base: master
Are you sure you want to change the base?
Conversation
Improve i18n Test Output and Add Detailed Logging
Fix grep command to work with absolute paths in CircleCI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rsoaresdev thank you for putting this together. this is a great addition!
let output = `--- i18n Test Results ---\n` | ||
output += `Total keys defined: ${allKeysDefined.length}\n` | ||
output += `Total keys used: ${allKeysUsed.length}\n` | ||
output += `Missing keys: ${missingKeys.length > 0 ? missingKeys.join(", ") : "None"}\n` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
this is nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, glad you liked it. That output is actually very useful.
I don't know why circle ci is not happy but locally I have this error when I run
|
The test uses process.cwd() to define the srcDir (process.cwd()/app), but Yarn’s sandbox creates temporary paths like /private/var/folders/..., which don’t always contain the expected project structure. When the grep command tries to scan these directories, it fails because the srcDir doesn’t exist. Can you try this way:
|
- Add robust directory detection for various environments (Yarn, Bun, npm) - Handle temporary directories - Add fallback paths and better error messages - Verify directory existence before running grep command
With my last commit the issue finding the right path is fixed. Now circle ci is not happy because it encounters many keys that are missing:
|
Looks like translation keys for demo code (that's why it only returned 12 keys defined). |
Improve i18n Test Output and Add Detailed Logging
Please verify the following:
yarn test
jest tests pass with new tests, if relevantyarn lint
eslint checks pass with new code, if relevantyarn format:check
prettier checks pass with new code, if relevantREADME.md
(or relevant documentation) has been updated with your changesDescribe your PR
Description:
Changes:
This update improves the overall test process for missing or unused translation keys, making it easier to catch issues and understand the results.
Screenshots (if applicable)