Skip to content

test: Separate faucet tests from local integration tests #2985

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

achaljhawar
Copy link

@achaljhawar achaljhawar commented May 18, 2025

High Level Overview of Change

This PR separates faucet-specific tests (which connect to external networks) from local integration tests in the xrpl.js library.

fixes #2615

Changes include:

  • Created a new /test/faucet/ directory structure for tests that depend on external faucet services
  • Moved fundWallet.test.ts from integration to faucet directory
  • Added separate Jest configuration for faucet tests (jest.config.faucet.js)
  • Updated integration test config to exclude faucet tests
  • Added new npm scripts for running different test types

Context of Change

Our integration test suite previously combined tests that run against a local rippled server with tests that connect to public testnet/devnet networks and use faucet services. This combination caused several issues:

  1. Slower CI/PR build times: Tests dependent on external networks are inherently slower and less reliable
  2. Increased load on public services: Frequent test runs against public faucets create unnecessary load
  3. Flaky test results: Failures in tests connecting to external services could block PRs when those services were unavailable or experiencing issues
  4. Difficult local development: Developers needed to wait for external service responses even when only working on local functionality

This refactoring creates a clear separation between local integration tests and faucet tests, allowing them to be run independently while maintaining the ability to run all tests when needed.

Type of Change

  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates

Did you update HISTORY.md?

  • Yes
  • No, this change does not impact library users

Test Plan

  1. Verified local integration tests still run successfully:
npm run test:integration
  1. Verified faucet tests run successfully with new configuration:
npm run test:faucet
  1. Verified all tests can be run together:
npm run test:all
  1. Checked that moved tests maintain the same functionality and assertions, just in a different location

Future Tasks

  • Consider implementing conditional faucet test execution in CI workflows
  • Evaluate adding more documentation about when to use each test type in CONTRIBUTING.md
  • Look for other tests that might be candidates for moving to the faucet directory

Copy link

coderabbitai bot commented May 18, 2025

Walkthrough

A new Jest configuration for faucet tests was introduced in the xrpl package, extending the base configuration with custom settings and test targeting. The integration test configuration was updated to exclude faucet tests. Two new npm scripts were added: one for running faucet tests and another for running all test suites sequentially.

Changes

File(s) Change Summary
packages/xrpl/jest.config.faucet.js Added a new Jest config for faucet tests, extending the base config, specifying roots, timeout, testMatch, and displayName.
packages/xrpl/jest.config.integration.js Updated comment for clarity and added testPathIgnorePatterns to exclude faucet tests from integration runs.
packages/xrpl/package.json Added test:faucet and test:all npm scripts for running faucet tests and all tests in sequence.

Poem

In the warren of code, a new test suite appears,
Faucet flows steady, dispelling old fears.
Integration hops past, ignoring the stream,
While scripts run together—a developer’s dream!
🐇✨
With configs aligned and scripts in a row,
The tests all assemble—ready, set, go!

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm warn config production Use --omit=dev instead.
npm warn EBADENGINE Unsupported engine {
npm warn EBADENGINE package: '@es-joy/jsdoccomment@0.36.1',
npm warn EBADENGINE required: { node: '^14 || ^16 || ^17 || ^18 || ^19' },
npm warn EBADENGINE current: { node: 'v24.0.2', npm: '11.3.0' }
npm warn EBADENGINE }
npm warn EBADENGINE Unsupported engine {
npm warn EBADENGINE package: 'eslint-plugin-jsdoc@39.9.1',
npm warn EBADENGINE required: { node: '^14 || ^16 || ^17 || ^18 || ^19' },
npm warn EBADENGINE current: { node: 'v24.0.2', npm: '11.3.0' }
npm warn EBADENGINE }
npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-05-18T20_30_40_643Z-debug-0.log

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

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

@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

🧹 Nitpick comments (1)
packages/xrpl/jest.config.integration.js (1)

12-12: Verify the ignore pattern for faucet tests
testPathIgnorePatterns uses regexp strings to skip test paths. Your pattern '<rootDir>/test/faucet/' may not match nested test files. Consider appending .* (e.g., '<rootDir>/test/faucet/.*') or using a regex like '/test\/faucet\//' to ensure all faucet tests are excluded from integration runs.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between f3f4e44 and 0827a1f.

📒 Files selected for processing (3)
  • packages/xrpl/jest.config.faucet.js (1 hunks)
  • packages/xrpl/jest.config.integration.js (2 hunks)
  • packages/xrpl/package.json (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/xrpl/jest.config.faucet.js (1)
packages/xrpl/jest.config.integration.js (1)
  • base (2-2)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Socket Security: Pull Request Alerts
🔇 Additional comments (5)
packages/xrpl/package.json (1)

63-64: Added dedicated faucet and composite test scripts
The new test:faucet and test:all scripts correctly integrate the faucet-specific Jest config and orchestrate sequential execution of all test suites, aligning with the PR’s goal to decouple external-service tests from local integration tests.

packages/xrpl/jest.config.faucet.js (4)

2-2: Import shared base Jest configuration
Reusing jest.config.base.js maintains consistency across all test suites and reduces duplication.


5-7: Extend test roots and set longer timeout for faucet tests
Including <rootDir>/test in roots ensures Jest discovers faucet tests, and increasing testTimeout to 60000 ms accommodates potential delays when interacting with public faucet endpoints.


8-11: Restrict test matching to faucet directory
The testMatch patterns target only .test.ts files under test/faucet/, effectively isolating faucet tests from unit and integration suites.


12-12: Distinct display name for the faucet suite
Naming this suite xrpl.js-faucet will make it easy to identify in CI logs and local outputs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Separate faucet tests from test:integration run script
1 participant