Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Nov 5, 2025

Summary

Adds the ability to conditionally run tests during the pre-push hook using a .env.local environment variable.

Changes

  • Modified .husky/pre-push to load .env.local if it exists
  • Added conditional test execution when RUN_TESTS_ON_PUSH=true
  • Uses existing pnpm run test command (turbo) to run all tests across the monorepo
  • Tests are skipped by default when RUN_TESTS_ON_PUSH is not set or false

Usage

Create or update .env.local:

# Enable tests on push
RUN_TESTS_ON_PUSH=true

# Disable tests on push (default)  
RUN_TESTS_ON_PUSH=false

Benefits

  • Developers can choose whether to run tests during push based on their workflow
  • Uses the existing comprehensive test suite via turbo
  • No verbose logging - clean output
  • Backwards compatible (tests disabled by default)

- Load .env.local environment variables if file exists
- Run tests via 'pnpm run test' when RUN_TESTS_ON_PUSH=true
- Users can control test execution by setting RUN_TESTS_ON_PUSH in .env.local
@daniel-lxs daniel-lxs requested review from cte, jr and mrubens as code owners November 5, 2025 17:00
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. Enhancement New feature or request labels Nov 5, 2025
@roomote
Copy link
Contributor

roomote bot commented Nov 5, 2025

See this task on Roo Code Cloud

Review complete. Found 1 security issue that needs to be addressed before merging.

  • Fix shell injection vulnerability in .env.local loading

Mention @roomote in a comment to trigger your PR Fixer agent and make changes to this pull request.

@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Nov 5, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 5, 2025
@mrubens mrubens merged commit 3eee340 into main Nov 5, 2025
20 checks passed
@mrubens mrubens deleted the feature/conditional-tests-pre-push branch November 5, 2025 17:06
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Nov 5, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Nov 5, 2025
Comment on lines +21 to +24
# Load .env.local if it exists
if [ -f ".env.local" ]; then
export $(grep -v '^#' .env.local | xargs)
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

Shell injection vulnerability: The export $(grep -v '^#' .env.local | xargs) pattern is unsafe when .env.local contains values with shell metacharacters (semicolons, backticks, command substitutions). For example, RUN_TESTS_ON_PUSH=true; rm -rf / would execute the deletion command. Use set -a; source .env.local; set +a instead, or properly quote and validate each variable before export.

Fix it with Roo Code or mention @roomote and request a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants