Skip to content

chore(stellar): extend the shared jest config - #344

Merged
Battambang merged 2 commits into
mainfrom
chore/stellar-wallet-snap-jest-config
Sep 22, 2026
Merged

Battambang merged 2 commits into
mainfrom
chore/stellar-wallet-snap-jest-config

Conversation

@Battambang

Copy link
Copy Markdown
Contributor

Description

Stellar's jest.config.js was a standalone configuration: it duplicated every setting instead of extending the repo-wide jest.config.packages.js. That made it drift from the other snap packages and, more importantly, it never inherited
the shared test environment setup.

This PR makes Stellar extend the shared base config, keeping only the package-specific overrides. It is the last of the per-package PRs following the base fix in #334.

What changed

  • packages/stellar-wallet-snap/jest.config.js now does require('../../jest.config.packages') and spreads it.
  • Removed settings that are identical in the base and are now inherited verbatim: collectCoverage, collectCoverageFrom (base uses the equivalent ./src/**/*.{ts,tsx}), coverageDirectory, coverageProvider, coverageReporters, resetMocks, restoreMocks.
  • setupFilesAfterEnv now composes [...baseConfig.setupFilesAfterEnv, '<rootDir>/jest.setup.ts'] instead of
    replacing the base list, so Stellar's own setup is preserved and the shared setup runs.
  • moduleNameMapper now spreads baseConfig.moduleNameMapper before adding the \.svg$ stub, so base mappings apply to Stellar.
  • Retained Stellar-specific overrides: preset: '@metamask/snaps-jest', transform (ts-jest), testMatch, the broad
    coveragePathIgnorePatterns list, and coverageThreshold.

Behavioral impact

  • New: Stellar now inherits setupFiles (tests/setup.ts) and setupFilesAfterEnv (tests/setupAfterEnv/index.ts), including the shared nock network isolation. Previously Stellar ran without any of it. All tests still pass, so the suite has no external-network dependency.
  • New: Stellar no longer overrides testEnvironment to node, so the @metamask/snaps-jest preset's environment is used.
  • Unchanged: coverage scope and thresholds. Because Stellar already collected both .ts and .tsx, coverage is byte-identical before and after (statements 85.67%, branches 70.77%, functions 79.82%, lines 85.63%).

Manual testing steps

Routine config change; verification is automated:

  1. yarn workspace @metamask/stellar-wallet-snap run build
  2. yarn workspace @metamask/stellar-wallet-snap run test
  3. yarn workspace @metamask/stellar-wallet-snap run test --coverage
  4. yarn lint:tsc

Checklist

  • Tests pass
  • Lint and formatting pass (eslint, prettier, lint:tsc)
  • Changelog unchanged (internal config only)
  • No coverage threshold regressions

Related to WPN-815.
Stacked on #334 (merged).

@Battambang
Battambang force-pushed the chore/stellar-wallet-snap-jest-config branch 2 times, most recently from 99fe6a9 to be4fa7e Compare September 22, 2026 07:56
@Battambang
Battambang marked this pull request as ready for review September 22, 2026 08:31
@Battambang
Battambang requested a review from a team as a code owner September 22, 2026 08:31
@Battambang
Battambang deployed to default-branch September 22, 2026 08:32 — with GitHub Actions Active
Replaces the standalone config with one that inherits from
jest.config.packages.js, so the package stops re-declaring coverage
scope, provider, reporters and the common ignore pattern. The eight
package-specific coveragePathIgnorePatterns entries, the coverage
thresholds and the stellar-sdk transformIgnorePatterns are preserved
unchanged.
@Battambang
Battambang force-pushed the chore/stellar-wallet-snap-jest-config branch from be4fa7e to 6f2c74d Compare September 22, 2026 13:01
Spread the shared ignore list instead of replacing it, so Stellar keeps
the base index.ts and jest.setup.ts entries and only adds its
package-specific exclusions.
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

No unresolved review issues remain.

Review effort: Lite
Findings: None

What changed in this PR

Updates Stellar’s Jest configuration to extend the shared package configuration while preserving Stellar-specific settings.

Changes:

  • Inherits shared setup, mappings, coverage defaults, and mock behavior.
  • Preserves Stellar-specific transforms, exclusions, thresholds, and test matching.
  • Composes shared and Stellar test setup files.
File Description
packages/​stellar-wallet-snap/​jest.config.js Extends the shared Jest configuration with Stellar-specific overrides.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Julink-eth Julink-eth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@Battambang
Battambang added this pull request to the merge queue Sep 22, 2026
Merged via the queue into main with commit 035e102 Sep 22, 2026
56 checks passed
@Battambang
Battambang deleted the chore/stellar-wallet-snap-jest-config branch September 22, 2026 13:52
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.

3 participants