Skip to content

test(common): support per-flavor skips and normalize recommend snapshots#7030

Draft
aymeric-giraudet wants to merge 1 commit into
chore/port-widget-vue-compatfrom
chore/port-widget-test-infra
Draft

test(common): support per-flavor skips and normalize recommend snapshots#7030
aymeric-giraudet wants to merge 1 commit into
chore/port-widget-vue-compatfrom
chore/port-widget-test-infra

Conversation

@aymeric-giraudet
Copy link
Copy Markdown
Member

Stacked on top of #7029.

Summary

Test infrastructure changes needed before the Vue recommendation/FilterSuggestions ports can land. No widget changes.

  • `tests/common/widgets/filter-suggestions/options.ts` and `templates.tsx` now use `skippableTest` / `skippableDescribe` for the cases Vue cannot reproduce 1:1:
    • The synchronous `throws without agentId` check (Vue's `created` hook swallows the throw).
    • The `templates` describe block (React/JS pass function-valued `templates`/`headerComponent`/`itemComponent`/`emptyComponent` props that Vue can't apply directly).
  • `tests/common/widgets/filter-suggestions/index.ts` exports a real `VueFilterSuggestionsWidgetParams` type (previously `vue: Record<string, never>`), and every test case in this suite now fills in proper Vue connector params (previously `vue: {}`).
  • The three recommendation widget suites (`related-products`, `trending-items`, `trending-facets`) now snapshot via `toMatchNormalizedInlineSnapshot(normalizeSnapshot, …)`, matching the existing `looking-similar` / `frequently-bought-together` pattern. Required because Vue 3 wraps native `` content with extra whitespace text nodes that the normalizer already strips.

Test plan

  • `npx jest packages/react-instantsearch packages/instantsearch.js --no-coverage` — 310 suites green.
  • Existing Vue 2 and Vue 3 suites still pass on these tests.

Next in the stack: React widgets.

Two small refactors to the shared widget test suites so the upcoming
Vue ports don't have to skip whole describe blocks:

- `filter-suggestions/options.ts` and `templates.tsx` now use
  `skippableTest` / `skippableDescribe` for the cases Vue can't
  reproduce 1:1 (sync connector throws Vue swallows, React/JS pass
  function-valued `templates`/`itemComponent`/`headerComponent`/
  `emptyComponent` props). Types in `index.ts` no longer mark
  `vue` as `Record<string, never>` so Vue can receive real connector
  params, and every test case fills in a proper Vue params payload.
- The recommendation widget suites (`related-products`,
  `trending-items`, `trending-facets`) now snapshot via
  `toMatchNormalizedInlineSnapshot(normalizeSnapshot, …)`, matching the
  existing `looking-similar` / `frequently-bought-together` pattern.
  Required because Vue 3 wraps native `Fragment`s with extra
  whitespace text nodes that the normalizer already strips.

No widget changes; React and JavaScript flavors keep their existing
behavior.
@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 2 duplication

Metric Results
Complexity 0
Duplication 2

View in Codacy

TIP This summary will be updated as you push new changes.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 13, 2026

More templates

algoliasearch-helper

npm i https://pkg.pr.new/algolia/instantsearch/algoliasearch-helper@7030

instantsearch-ui-components

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch-ui-components@7030

instantsearch.css

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch.css@7030

instantsearch.js

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch.js@7030

react-instantsearch

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch@7030

react-instantsearch-core

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-core@7030

react-instantsearch-nextjs

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-nextjs@7030

react-instantsearch-router-nextjs

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-router-nextjs@7030

vue-instantsearch

npm i https://pkg.pr.new/algolia/instantsearch/vue-instantsearch@7030

commit: ed2ecf7

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.

1 participant