Skip to content

Settings page regression tests (6/6): type-check and format-check the test suites in CI - #138

Merged
joaquimds merged 9 commits into
masterfrom
test-suite-type-checks
Nov 12, 2026
Merged

joaquimds merged 9 commits into
masterfrom
test-suite-type-checks

Conversation

@conatus

@conatus conatus commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Sixth and last of the settings page regression test PRs. Adds type checking and formatting checks to the test suites, so they stay tidy.

Stacked on #137 (the last PR that adds tests), so the checks cover the new settings tests too, not just what's on master today.

What CI now checks

Suite Before Now
Join form + Jest tests (packages/join-flow) Prettier Prettier, type check (tsc --noEmit)
E2E tests and fake API (packages/join-e2e) nothing Prettier, type check (strict, including the fake API's JavaScript via checkJs and JSDoc types)
PHPUnit tests (packages/join-block/tests) nothing (excluded from phpcs and PHPStan) phpcs, PHPStan (level 5, like the plugin)

The type checks run in the Jest Tests workflow's Jest job (now "Jest tests and type check"), which already installs join-flow's dependencies, using the same root npm run typecheck as local runs. Prettier's existing job now covers both JS packages. phpcs and PHPStan run in the existing PHP lint job via composer lint.

Changes to get there

  • Join form (the only plugin source change, types only): the plan page's useForm is now typed with FormSchema, as the donation page's is. The income guidance table (JOIN-150 Add optional income guidance to the membership step #125) added the page's first setValue calls, and with no type TypeScript allowed no field names, so the new type check failed on master's code.
  • E2E:
    • New tsconfig.json, plus typescript and @types/node (Node 20, matching CI) dev dependencies, and an npm run typecheck script.
    • The E2E tests already type-checked under strict.
    • Its own .prettierrc.json (single quotes, 120 columns, trailing commas), matching how the tests were written. The repo's root settings would have restyled ~3,500 lines.
  • PHP tests:
    • phpcs allows snake_case method names in tests, since the test doubles mirror WordPress's $wpdb API (get_results, esc_like).
    • The other phpcs errors were whitespace, fixed by phpcbf.
    • PHPStan's 3 findings are fixed: an unused property; a Mockery double of wpdb; and resetting Stripe's HTTP client to its default CurlClient rather than null, which the SDK's signature doesn't allow.
  • Fake API: JSDoc types so it passes the strict check. A Stripe seed with bad JSON now gets a 400 instead of crashing the fake.
  • Root scripts: npm run prettier formats both JS packages; npm run typecheck checks both (it needs npm --prefix packages/join-e2e ci first).
  • Readme: the testing section is updated.

Testing

After merging master (via #134 to #137):

  • npm run typecheck, prettier --check packages/join-flow packages/join-e2e, and composer lint all pass.
  • PHPUnit: 222 tests pass. Jest: 86 tests pass.
  • Full E2E suite, without retries: 225 passed, 10 skipped (known bugs).

Generated by Claude Code

- Type check (new CI job): the join form and its Jest tests, and the E2E
  tests, which gain a tsconfig. Both already passed; CI didn't run either.
  `npm run typecheck` runs both.
- Prettier now checks packages/join-e2e as well as packages/join-flow.
  The E2E package gets its own settings matching how its tests were
  written (single quotes, 120 columns, trailing commas), so formatting it
  is a small change rather than a restyle.
- phpcs and PHPStan now cover the PHPUnit tests. phpcs allows snake_case
  method names there (test doubles mirror WordPress's $wpdb API); its
  other findings were whitespace, fixed with phpcbf. PHPStan's three
  findings are fixed: an unused property, a Mockery double typed as
  wpdb, and resetting Stripe's HTTP client to its default rather than
  null.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BL2bFrTk84JMy3CPAsCTV9
Comment thread package.json Resolved
Comment thread .github/workflows/jest-tests.yml Resolved
Comment thread .github/workflows/jest-tests.yml Resolved
Comment thread packages/join-block/phpcs.xml Resolved
Comment thread packages/join-e2e/package.json Resolved
Comment thread packages/join-e2e/tsconfig.json Resolved
# Conflicts:
#	packages/join-e2e/tests/settings/integrations-logging.spec.ts
#	packages/join-e2e/tests/settings/logging-debug.spec.ts
#	packages/join-e2e/tests/settings/membership-plans.spec.ts
#	packages/join-e2e/tests/settings/theme.spec.ts
- Remove the CamelCaps phpcs:ignore comments in tests, which phpcs.xml
  now excludes for tests anyway.
- Mock wpdb by class, so the @var matches the real type.
- CI type check: skip the root postinstall (Composer), and run the root
  typecheck script rather than repeating its steps.
- Type-check the fake API (with a looser config, so plain JS needs no
  annotations), and pin @types/node to 20 to match CI's Node.
- Readme: the type check needs the E2E dependencies installed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BL2bFrTk84JMy3CPAsCTV9
@conatus conatus changed the title Type-check and format-check the test suites in CI Settings page regression tests (6/6): type-check and format-check the test suites in CI Oct 25, 2026
@linear-code

linear-code Bot commented Oct 25, 2026

Copy link
Copy Markdown

JOIN-173

…hecks

Brings in #133 as merged, including its follow-up review changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BL2bFrTk84JMy3CPAsCTV9

# Conflicts:
#	packages/join-e2e/tests/admin-plan-redirect.spec.ts
The income guidance table (#125) added the plan page's first setValue
calls. The page's useForm had no type, so TypeScript allowed no field
names at all, and the type check this PR adds failed. Give it FormSchema,
as the donation page does. Types only; nothing changes at runtime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BL2bFrTk84JMy3CPAsCTV9
@joaquimds
joaquimds changed the base branch from admin-e2e-logging-debug to master November 12, 2026 11:44
joaquimds and others added 4 commits November 12, 2026 11:45
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
StripePriceReuseTest (from #146) arrived with the merge of master. With
phpcs and PHPStan now covering the tests:
- Put the log stub's empty method bodies on their own lines (phpcbf).
- Drop its CamelCaps phpcs:ignore comments; phpcs.xml excludes that rule
  for tests.
- Reset Stripe's HTTP client to its default CurlClient rather than null,
  which the SDK's signature doesn't allow, as StripeInvoicePaidTest does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BL2bFrTk84JMy3CPAsCTV9
PHPStan now covers the tests and reports that $argv might not be
defined at file scope.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Type-check the fake API strictly: JSDoc types for its requests,
  overrides and Stripe store, instead of turning off noImplicitAny and
  useUnknownInCatchVariables. A Stripe seed with bad JSON now gets a 400
  rather than crashing the fake.
- Stub $wpdb in SettingsMembershipPlanLookupTest with a plain class, as
  the other tests do. A Mockery double of \wpdb declared an empty global
  wpdb class, as WordPress isn't loaded in unit tests.
- Merge the two CamelCapsMethodName rules in phpcs.xml into one.
- Run the type check in the Jest job, which already installs join-flow's
  dependencies, instead of a separate job with its own install.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@joaquimds
joaquimds merged commit 121d837 into master Nov 12, 2026
6 checks passed
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.

3 participants