Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .agents/skills/changeset/no-agent-impact.json
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."
}
16 changes: 16 additions & 0 deletions .changeset/test-mock-reexports.md
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.
2 changes: 1 addition & 1 deletion packages/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"@testing-library/react": "^16.0.0"
},
"peerDependencies": {
"@data-client/react": "^0.12.15 || ^0.13.0 || ^0.14.0 || ^0.15.0 || ^0.16.0 || ^0.17.0 || ^0.18.0",
"@data-client/react": "^0.15.0 || ^0.16.0 || ^0.17.0 || ^0.18.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Raise the React 0.15 peer floor to 0.15.3

When a CommonJS/Jest consumer installs one of the permitted @data-client/react versions 0.15.0–0.15.2, the new imports of @data-client/react/mock fail with ESM parsing errors. The repository's React changelog explicitly records CommonJS support for the /mock subpath as a 0.15.3 fix (packages/react/CHANGELOG.md lines 293–299), whereas the previous @data-client/test bundle did not depend on that subpath. Set the peer floor to ^0.15.3 and update the migration text accordingly.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

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.2 export ./mock with only types/default (ESM), and require: ./dist/mock.js first appears in 0.15.3. This predates the PR (the old dist/index.js already required @data-client/react/mock for mockInitialState), 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.3 and update the changeset and migration text to say 0.15.3.


Generated by Claude Code

"@testing-library/react-hooks": "^8.0.0",
"@testing-library/react-native": "^13.0.0 || ^14.0.0",
"@types/react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-0 || ^19.0.0",
Expand Down
150 changes: 0 additions & 150 deletions packages/test/src/MockController.ts

This file was deleted.

5 changes: 2 additions & 3 deletions packages/test/src/MockResolver.tsx
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';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the current fixture argument types with older peers

When the new @data-client/test is paired with any still-permitted 0.15–0.18 React release, MockResolverProps now inherits that older release's MockProps and fixture declarations rather than this release's declarations. In particular, the current release's .changeset/fixture-args-readonly.md promises that args: [...] as const is accepted, but that fix landed after 0.18.1; with an older peer the same fixture is rejected again. Either require the matching React release or keep a local type façade so @data-client/test's advertised types do not vary with the installed peer.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

True: with @data-client/test 0.19 and @data-client/react 0.18.x, fixture types come from react 0.18, so args: [...] as const (.changeset/fixture-args-readonly.md) only type-checks once react is upgraded too. A local type façade would bring back the duplicate this PR removes. The packages release linked, and both the changeset and the v0.19 migration guide tell users to upgrade @data-client/react with @data-client/test. The alternative is narrowing the peer to the matching release, and I've put that choice to the maintainer rather than build anything here.


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;
Expand Down
6 changes: 2 additions & 4 deletions packages/test/src/browser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import mockInitialState from './mockState.js';
export { default as MockResolver } from './MockResolver.js';
export type {
FixtureEndpoint,
Expand All @@ -8,6 +7,5 @@ export type {
SuccessFixture,
ErrorFixture,
Interceptor,
} from './fixtureTypes.js';

export { mockInitialState };
} from '@data-client/react/mock';
export { mockInitialState } from '@data-client/react/mock';
21 changes: 0 additions & 21 deletions packages/test/src/collapseFixture.ts

This file was deleted.

26 changes: 0 additions & 26 deletions packages/test/src/createFixtureMap.tsx

This file was deleted.

120 changes: 0 additions & 120 deletions packages/test/src/fixtureTypes.ts

This file was deleted.

Loading
Loading