Repository navigation
pkg(test)!: Re-export mock utilities from @data-client/react/mock #4414
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
Changes from all commits
695337a
1e2a52a
7a08207
c4ba6ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| { | ||
| "drop-typescript-3": "Agents don't install or keep TypeScript 3.x, so no realistic task hits the old behavior." | ||
| "drop-typescript-3": "Agents don't install or keep TypeScript 3.x, so no realistic task hits the old behavior.", | ||
| "test-mock-reexports": "Agent-written test code and imports are the same before and after; only install-time peer resolution changes, for projects pinned to @data-client/react 0.14 or older." | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| --- | ||
| '@data-client/test': minor | ||
| --- | ||
|
|
||
| BREAKING: `@data-client/test` requires `@data-client/react` 0.15 or later | ||
|
|
||
| Support for `@data-client/react` 0.12 through 0.14 is dropped, since `@data-client/test` imports | ||
| `@data-client/react/mock`, which first shipped in 0.15. Upgrade `@data-client/react` along with `@data-client/test`. | ||
|
|
||
| ```diff title="package.json" | ||
| - "@data-client/react": "^0.14.0", | ||
| + "@data-client/react": "^0.19.0", | ||
| ``` | ||
|
|
||
| `Fixture`, `Interceptor`, and the other fixture types from `@data-client/test` are now the same types that | ||
| `@data-client/react/mock` exports, so fixtures typed with either import work everywhere. |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,10 @@ | ||
| 'use client'; | ||
| import { ControllerContext, useController } from '@data-client/react'; | ||
| import { MockController } from '@data-client/react/mock'; | ||
| import type { MockProps } from '@data-client/react/mock'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the new Useful? React with 👍 / 👎.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True: with Generated by Claude Code |
||
| import { useMemo } from 'react'; | ||
| import React from 'react'; | ||
|
|
||
| import { MockController } from './MockController.js'; | ||
| import { MockProps } from './mockTypes.js'; | ||
|
|
||
| export interface MockResolverProps<T> extends MockProps<T> { | ||
| children: React.ReactNode; | ||
| silenceMissing?: boolean; | ||
|
|
||
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a CommonJS/Jest consumer installs one of the permitted
@data-client/reactversions 0.15.0–0.15.2, the new imports of@data-client/react/mockfail with ESM parsing errors. The repository's React changelog explicitly records CommonJS support for the/mocksubpath as a 0.15.3 fix (packages/react/CHANGELOG.mdlines 293–299), whereas the previous@data-client/testbundle did not depend on that subpath. Set the peer floor to^0.15.3and update the migration text accordingly.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed from the published tarballs:
@data-client/react@0.15.0–0.15.2export./mockwith onlytypes/default(ESM), andrequire: ./dist/mock.jsfirst appears in 0.15.3. This predates the PR (the olddist/index.jsalready required@data-client/react/mockformockInitialState), but the stated floor should be accurate. Since this PR is in the merge queue, the follow-up PR will raise the peer to^0.15.3and update the changeset and migration text to say 0.15.3.Generated by Claude Code