Skip to content

Conversation

@itsarijitray
Copy link
Contributor

@itsarijitray itsarijitray commented Jan 19, 2026

This pull request introduces comprehensive automated tests to ensure that the actions-shared and actions-core packages remain environment-agnostic. The new tests recursively scan source files to detect accidental usage of browser-specific or Node.js-specific globals, as well as unsafe import patterns. This helps maintain cross-environment compatibility and prevents regressions as the codebase evolves.

I have written tests and lint rules. However those have some exceptions as there are some pre-existing environment specific code like:

  • use of process in isDestinationActionService.ts in actions-shared which is used in actions-personas-messaging-sendgrid
  • use of Buffer in MessageSendPerformer.ts in actions-shared which is used in actions-personas-messaging-sendgrid
  • use of process , globalThis & events in actions-core

Testing

Include any additional information about the testing you have completed to
ensure your changes behave as expected. For a speedy review, please check
any of the tasks you completed below during your testing.

  • Added unit tests for new functionality
  • Tested end-to-end using the local server
  • [If destination is already live] Tested for backward compatibility of destination. Note: New required fields are a breaking change.
  • [Segmenters] Tested in the staging environment
  • [Segmenters] [If applicable for this change] Tested for regression with Hadron.

Security Review

Please ensure sensitive data is properly protected in your integration.

  • Reviewed all field definitions for sensitive data (API keys, tokens, passwords, client secrets) and confirmed they use type: 'password'

@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.35%. Comparing base (e9222d4) to head (b22f0ad).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3526      +/-   ##
==========================================
+ Coverage   80.01%   80.35%   +0.34%     
==========================================
  Files        1249     1320      +71     
  Lines       23127    26200    +3073     
  Branches     4607     5481     +874     
==========================================
+ Hits        18505    21054    +2549     
- Misses       3760     4257     +497     
- Partials      862      889      +27     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@itsarijitray
Copy link
Contributor Author

Tested here in #3527

@itsarijitray
Copy link
Contributor Author

image Unit tests working

@itsarijitray itsarijitray changed the title add tests Add CI Tests to prevent environment variable/browser objects in actions-shared and actions-core Jan 21, 2026
@itsarijitray itsarijitray marked this pull request as ready for review January 21, 2026 06:33
@harsh-joshi99 harsh-joshi99 requested a review from Copilot January 21, 2026 06:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request introduces comprehensive automated testing and linting rules to enforce environment-agnostic code in the actions-core and actions-shared packages. The changes add Jest-based tests that recursively scan source files to detect browser-specific globals (window, document, etc.), Node.js-specific globals (process, Buffer, etc.), and unsafe import patterns. Additionally, ESLint rules are configured to prevent these patterns during development.

Changes:

  • Added environment-specific code detection tests for actions-core package
  • Added environment-specific code detection tests for actions-shared package
  • Extended ESLint configuration with restricted globals and imports rules

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 12 comments.

File Description
packages/core/src/tests/no-environment-specific-code.test.ts New test suite for detecting browser/Node.js-specific code in actions-core, including checks for globals, imports, and unsafe environment detection patterns
packages/actions-shared/src/tests/no-environment-specific-code.test.ts New test suite for detecting browser/Node.js-specific code in actions-shared, with similar checks but missing the environment detection patterns test
.eslintrc.js Extended ESLint configuration with no-restricted-globals and no-restricted-imports rules for actions-core and actions-shared packages, with specific file exclusions

@itsarijitray
Copy link
Contributor Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Jan 22, 2026

@itsarijitray I've opened a new pull request, #3537, to work on those changes. Once the pull request is ready, I'll request review from you.

…ection coverage (#3537)

* Initial plan

* Address review feedback: improve test consistency and fix comment detection

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants