Skip to content

Commit 881e03c

Browse files
committed
fix(core): reject function mock generators early in tags-split mode
Adds a pre-check before filtering generators so that function-based entries (ClientMockBuilder) cause a clear error instead of being silently dropped.
1 parent 8e70924 commit 881e03c

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

packages/core/src/writers/split-tags-mode.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,15 @@ export async function writeSplitTagsMode({
4646
output.tsconfig,
4747
);
4848

49-
// Resolve concrete (non-function) generator entries so we can iterate over
50-
// them when writing per-entry index files.
49+
const hasFunctionGenerators = output.mock.generators.some((g) =>
50+
isFunction(g),
51+
);
52+
if (hasFunctionGenerators) {
53+
throw new Error(
54+
'Function mock generators (ClientMockBuilder) are not supported in tags-split mode. Use typed generators ({ type: "msw" } or { type: "faker" }).',
55+
);
56+
}
57+
5158
const generatorEntries = output.mock.generators.filter(
5259
(g): g is GlobalMockOptions => !isFunction(g),
5360
);

0 commit comments

Comments
 (0)