chore(tsconfig): turn off the Schema-over-JSON diagnostic in test files (#16375)

Co-authored-by: Julius Marminge <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
authored and GitHub committed 2026-10-06 14:26:16 -07:00
1 parent fbe5df2d4b
commit 7bee189dfb
32 files changed
+14 -192

No files matched your search

@@ -228,7 +228,6 @@ layer("AzureDevOpsPullRequestCli.layer", (it) => {
...row,
description: "x".repeat(10_000),
}));
// @effect-diagnostics-next-line preferSchemaOverJson:off
const response = JSON.stringify(rows);
expect(Buffer.byteLength(response)).toBeGreaterThan(1_000_000);
@@ -341,7 +340,6 @@ layer("AzureDevOpsPullRequestCli.layer", (it) => {
.mockReturnValueOnce(
Effect.succeed(
output(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify([
{ pullRequestId: "malformed" },
pullRequestRows(1, 1)[0],
@@ -434,7 +432,6 @@ layer("AzureDevOpsPullRequestCli.layer", (it) => {
Effect.gen(function* () {
// `--query user` unwraps the object, so the wrapper has to put it back.
mockedExecute.mockReturnValueOnce(
// @effect-diagnostics-next-line preferSchemaOverJson:off
Effect.succeed(output(JSON.stringify({ name: "[email protected]", type: "user" }))),
);
const cli = yield* AzureDevOpsPullRequestCli.AzureDevOpsPullRequestCli;
@@ -636,7 +633,6 @@ layer("AzureDevOpsPullRequestCli.layer", (it) => {
.mockReturnValueOnce(
Effect.succeed(
output(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({
pullRequestId: 42,
title: "Add the page",
@@ -653,7 +649,6 @@ layer("AzureDevOpsPullRequestCli.layer", (it) => {
.mockReturnValueOnce(
Effect.succeed(
output(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({
value: [
{
@@ -674,7 +669,6 @@ layer("AzureDevOpsPullRequestCli.layer", (it) => {
.mockReturnValueOnce(
Effect.succeed(
output(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({
changeEntries: [
{ changeType: "edit", item: { path: "/README.md", objectId: "8f80" } },
@@ -713,7 +707,6 @@ layer("AzureDevOpsPullRequestCli.layer", (it) => {
// pull request read every time they checked whether a file had been pushed to.
const pullRequest = Effect.succeed(
output(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({
pullRequestId: 42,
title: "Add the page",
@@ -1219,7 +1212,6 @@ layer("AzureDevOpsPullRequestCli.layer", (it) => {
mockedExecute.mockReturnValueOnce(
Effect.succeed(
output(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({
value: [
{
@@ -1374,7 +1366,6 @@ layer("AzureDevOpsPullRequestCli.layer", (it) => {
Effect.succeed(
output(
// Well-formed, but with nothing to build a link from: not a decode failure.
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({
pullRequestId: 42,
title: "Add the page",
@@ -676,7 +676,6 @@ layer("BitbucketPullRequestApi.layer", (it) => {
expect(call.method).toBe("PUT");
expect(call.url).toBe("/repositories/acme/web/pullrequests/7");
// Bitbucket's PUT is a partial update, so a field left out of the body is left as it was.
// @effect-diagnostics-next-line preferSchemaOverJson:off
expect(JSON.parse(call.body ?? "")).toEqual({ title: "A new title" });
}),
);
@@ -688,7 +687,6 @@ layer("BitbucketPullRequestApi.layer", (it) => {
yield* api.updateChangeRequest({ repository: "acme/web", number: 7, body: "New body." });
// @effect-diagnostics-next-line preferSchemaOverJson:off
expect(JSON.parse(callAt(0).body ?? "")).toEqual({ description: "New body." });
}),
);
@@ -705,7 +703,6 @@ layer("BitbucketPullRequestApi.layer", (it) => {
body: "New body.",
});
// @effect-diagnostics-next-line preferSchemaOverJson:off
expect(JSON.parse(callAt(0).body ?? "")).toEqual({
title: "A new title",
description: "New body.",
@@ -736,7 +733,6 @@ layer("BitbucketPullRequestApi.layer", (it) => {
it.effect("fails the read when Bitbucket answers with something unreadable", () =>
Effect.gen(function* () {
mockedRequest.mockReturnValueOnce(
// @effect-diagnostics-next-line preferSchemaOverJson:off
Effect.succeed(response(JSON.stringify({ error: "nope" }))),
);
const api = yield* BitbucketPullRequestApi.BitbucketPullRequestApi;
@@ -769,7 +765,6 @@ layer("BitbucketPullRequestApi.layer", (it) => {
it.effect("fails when the credentials belong to no named account", () =>
Effect.gen(function* () {
// @effect-diagnostics-next-line preferSchemaOverJson:off
mockedRequest.mockReturnValueOnce(Effect.succeed(response(JSON.stringify({}))));
const api = yield* BitbucketPullRequestApi.BitbucketPullRequestApi;
@@ -784,7 +779,6 @@ layer("BitbucketPullRequestApi.layer", (it) => {
mockedRequest.mockReturnValueOnce(
Effect.succeed(
response(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({
next: "https://api.bitbucket.org/2.0/comments?page=2",
values: [
@@ -805,7 +799,6 @@ layer("BitbucketPullRequestApi.layer", (it) => {
response(
// The reply arrives a page after the remark it answers, which is why the threads
// are only assembled once every page is in hand.
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({
values: [
{
@@ -840,7 +833,6 @@ layer("BitbucketPullRequestApi.layer", (it) => {
mockedRequest.mockReturnValue(
Effect.succeed(
response(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({
next: "https://api.bitbucket.org/2.0/comments?page=2",
values: [
@@ -868,7 +860,6 @@ layer("BitbucketPullRequestApi.layer", (it) => {
mockedRequest.mockReturnValueOnce(
Effect.succeed(
response(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({
values: [
{
@@ -941,7 +932,6 @@ layer("BitbucketPullRequestApi.layer", (it) => {
});
expect(callAt(0).url).toContain("/pullrequests/7/comments");
// @effect-diagnostics-next-line preferSchemaOverJson:off
expect(JSON.parse(callAt(0).body ?? "")).toEqual({
content: { raw: "why remove?" },
inline: { path: "src/a.ts", from: 12 },
@@ -988,7 +978,6 @@ layer("BitbucketPullRequestApi.layer", (it) => {
body: "Fixed.",
});
// @effect-diagnostics-next-line preferSchemaOverJson:off
expect(JSON.parse(callAt(0).body ?? "")).toEqual({
content: { raw: "Fixed." },
parent: { id: 10 },
@@ -1001,7 +990,6 @@ layer("BitbucketPullRequestApi.layer", (it) => {
mockedRequest.mockReturnValue(
Effect.succeed(
response(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({ values: [{ type: "repository_permission", permission: "read" }] }),
),
),
@@ -1017,7 +1005,6 @@ layer("BitbucketPullRequestApi.layer", (it) => {
it.effect("escapes a repository name before it goes inside a filter literal", () =>
Effect.gen(function* () {
// @effect-diagnostics-next-line preferSchemaOverJson:off
mockedRequest.mockReturnValue(Effect.succeed(response(JSON.stringify({ values: [] }))));
const api = yield* BitbucketPullRequestApi.BitbucketPullRequestApi;
@@ -1075,7 +1062,6 @@ layer("BitbucketPullRequestApi.layer", (it) => {
.mockReturnValueOnce(
Effect.succeed(
response(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({ values: [{ user: bilal }, { user: octocat }, { user: hubot }] }),
),
),
@@ -1113,7 +1099,6 @@ layer("BitbucketPullRequestApi.layer", (it) => {
const call = callAt(1);
expect(call.method).toBe("PUT");
expect(call.url).toBe("/repositories/acme/web/pullrequests/7");
// @effect-diagnostics-next-line preferSchemaOverJson:off
expect(JSON.parse(call.body ?? "")).toEqual({
reviewers: [{ uuid: "{octocat}" }, { uuid: "{hubot}" }],
});
@@ -1136,7 +1121,6 @@ layer("BitbucketPullRequestApi.layer", (it) => {
requested: false,
});
// @effect-diagnostics-next-line preferSchemaOverJson:off
expect(JSON.parse(callAt(1).body ?? "")).toEqual({ reviewers: [{ uuid: "{octocat}" }] });
}),
);
@@ -789,7 +789,6 @@ layer("GitHubPullRequestCli.layer", (it) => {
mockedExecute.mockReturnValueOnce(
Effect.succeed(
output(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({
data: { w0: { pullRequest: node(1) }, w1: { pullRequest: null } },
}),
@@ -226,10 +226,8 @@ layer("GitLabPullRequestCli.layer", (it) => {
it.effect("advances the cursor through malformed raw rows", () =>
Effect.gen(function* () {
// @effect-diagnostics-next-line preferSchemaOverJson:off
const rows = JSON.parse(mergeRequests(2, 1)) as ReadonlyArray<unknown>;
mockedExecute.mockReturnValueOnce(
// @effect-diagnostics-next-line preferSchemaOverJson:off
Effect.succeed(output(JSON.stringify([{ iid: "malformed" }, ...rows]))),
);
const cli = yield* GitLabPullRequestCli.GitLabPullRequestCli;
@@ -314,7 +312,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
Effect.gen(function* () {
// Full pages of unusable rows: nothing is collected, so the collected-count bound never
// trips and only the page bound can end the walk.
// @effect-diagnostics-next-line preferSchemaOverJson:off
const unusable = JSON.stringify(Array.from({ length: 100 }, () => ({ iid: "nope" })));
mockedExecute.mockReturnValue(Effect.succeed(output(unusable)));
const cli = yield* GitLabPullRequestCli.GitLabPullRequestCli;
@@ -627,7 +624,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
it.effect("reports a commit with no parent as a structured error", () =>
Effect.gen(function* () {
mockedExecute.mockReturnValueOnce(
// @effect-diagnostics-next-line preferSchemaOverJson:off
Effect.succeed(output(JSON.stringify({ id: "a1b2c3d", parent_ids: [] }))),
);
const cli = yield* GitLabPullRequestCli.GitLabPullRequestCli;
@@ -654,7 +650,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
it.effect("expands a new file from a root commit without requiring a parent", () =>
Effect.gen(function* () {
mockedExecute.mockReturnValueOnce(
// @effect-diagnostics-next-line preferSchemaOverJson:off
Effect.succeed(output(JSON.stringify({ id: "a1b2c3d", parent_ids: [] }))),
);
mockedExecute.mockReturnValueOnce(Effect.succeed(output("first contents\n")));
@@ -680,7 +675,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
mockedExecute.mockReturnValueOnce(
Effect.succeed(
output(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({
diff_refs: {
base_sha: "a1b2c3d",
@@ -718,7 +712,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
mockedExecute.mockReturnValueOnce(
Effect.succeed(
output(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({
diff_refs: {
base_sha: "a1b2c3d",
@@ -758,7 +751,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
mockedExecute.mockReturnValueOnce(
Effect.succeed(
output(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({
diff_refs: {
base_sha: "a1b2c3d",
@@ -823,7 +815,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
it.effect("offers no squash when the project does not say it allows one", () =>
Effect.gen(function* () {
mockedExecute.mockReturnValueOnce(
// @effect-diagnostics-next-line preferSchemaOverJson:off
Effect.succeed(output(JSON.stringify({ merge_method: "merge" }))),
);
const cli = yield* GitLabPullRequestCli.GitLabPullRequestCli;
@@ -840,7 +831,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
it.effect("reads the project's merge settings as its merge capabilities", () =>
Effect.gen(function* () {
mockedExecute.mockReturnValueOnce(
// @effect-diagnostics-next-line preferSchemaOverJson:off
Effect.succeed(output(JSON.stringify({ merge_method: "ff", squash_option: "never" }))),
);
const cli = yield* GitLabPullRequestCli.GitLabPullRequestCli;
@@ -884,7 +874,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
it.effect("fails when the authenticated account has no username", () =>
Effect.gen(function* () {
// @effect-diagnostics-next-line preferSchemaOverJson:off
mockedExecute.mockReturnValueOnce(Effect.succeed(output(JSON.stringify({ username: "" }))));
const cli = yield* GitLabPullRequestCli.GitLabPullRequestCli;
@@ -935,7 +924,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
mockedExecute.mockReturnValueOnce(
Effect.succeed(
output(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify([
{
id: "abc123",
@@ -994,7 +982,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
mockedExecute.mockReturnValueOnce(
Effect.succeed(
output(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({
iid: 7,
title: "t",
@@ -1030,7 +1017,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
// The diff revisions first, because a positioned comment cannot be placed without them.
expect(argsOfCall(0)[1]).toContain("merge_requests/7");
expect(argsOfCall(1)[1]).toContain("/discussions");
// @effect-diagnostics-next-line preferSchemaOverJson:off
expect(JSON.parse(callAt(1).stdin ?? "")).toEqual({
body: "why remove?",
position: {
@@ -1086,7 +1072,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
expect(argsOfCall(0)).toContain("--method");
expect(argsOfCall(0)).toContain("PUT");
expect(argsOfCall(0)[1]).toContain("/discussions/abc123");
// @effect-diagnostics-next-line preferSchemaOverJson:off
expect(JSON.parse(callAt(0).stdin ?? "")).toEqual({ resolved: true });
}),
);
@@ -1117,13 +1102,11 @@ layer("GitLabPullRequestCli.layer", (it) => {
it.effect("removes an award by listing them and deleting the reader's own id", () =>
Effect.gen(function* () {
mockedExecute.mockReturnValueOnce(
// @effect-diagnostics-next-line preferSchemaOverJson:off
Effect.succeed(output(JSON.stringify({ username: "bilal" }))),
);
mockedExecute.mockReturnValueOnce(
Effect.succeed(
output(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify([
{ id: 5, name: "thumbsup", user: { username: "bilal" } },
{ id: 6, name: "thumbsup", user: { username: "julius" } },
@@ -1155,7 +1138,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
it.effect("does nothing when the reader has no award of that name to take back", () =>
Effect.gen(function* () {
mockedExecute.mockReturnValueOnce(
// @effect-diagnostics-next-line preferSchemaOverJson:off
Effect.succeed(output(JSON.stringify({ username: "bilal" }))),
);
mockedExecute.mockReturnValueOnce(Effect.succeed(output("[]")));
@@ -1179,7 +1161,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
mockedExecute.mockReturnValueOnce(
Effect.succeed(
output(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({
iid: 7,
title: "t",
@@ -1217,10 +1198,7 @@ layer("GitLabPullRequestCli.layer", (it) => {
mockedExecute
.mockReturnValueOnce(Effect.succeed(output(mergeRequestJson({ reviewers: [reviewer] }))))
.mockReturnValueOnce(
Effect.succeed(
// @effect-diagnostics-next-line preferSchemaOverJson:off
output(JSON.stringify([author, reviewer, { id: 9, username: "hubot" }])),
),
Effect.succeed(output(JSON.stringify([author, reviewer, { id: 9, username: "hubot" }]))),
);
const cli = yield* GitLabPullRequestCli.GitLabPullRequestCli;
@@ -1258,7 +1236,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
// GitLab replaces the whole set, so the reviewer already on the merge request has to be
// sent back with the new one or the request would take them off it.
expect(argsOfCall(1)).toContain("PUT");
// @effect-diagnostics-next-line preferSchemaOverJson:off
expect(JSON.parse(callAt(1).stdin ?? "")).toEqual({ reviewer_ids: [5, 9] });
}),
);
@@ -1282,7 +1259,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
requested: false,
});
// @effect-diagnostics-next-line preferSchemaOverJson:off
expect(JSON.parse(callAt(1).stdin ?? "")).toEqual({ reviewer_ids: [5] });
}),
);
@@ -1303,7 +1279,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
});
// Sending it as a number would rewrite the reviewer set around something nobody chose.
// @effect-diagnostics-next-line preferSchemaOverJson:off
expect(JSON.parse(callAt(1).stdin ?? "")).toEqual({ reviewer_ids: [5] });
}),
);
@@ -1330,7 +1305,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
"--header",
"Content-Type: application/json",
]);
// @effect-diagnostics-next-line preferSchemaOverJson:off
expect(JSON.parse(callAt(0).stdin ?? "")).toEqual({ title: "A better title" });
}),
);
@@ -1348,7 +1322,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
});
// A title sent as an empty string would wipe the one the merge request already has.
// @effect-diagnostics-next-line preferSchemaOverJson:off
expect(JSON.parse(callAt(0).stdin ?? "")).toEqual({ description: "What this changes." });
}),
);
@@ -1367,7 +1340,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
});
assert.strictEqual(mockedExecute.mock.calls.length, 1);
// @effect-diagnostics-next-line preferSchemaOverJson:off
expect(JSON.parse(callAt(0).stdin ?? "")).toEqual({
title: "A better title",
description: "What this changes.",
@@ -1407,7 +1379,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
mockedExecute.mockReturnValueOnce(
Effect.succeed(
output(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({
iid: 7,
title: "t",
@@ -1424,7 +1395,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
mockedExecute.mockReturnValueOnce(
Effect.succeed(
output(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({
data: {
project: { repository: { blobs: { nodes: [{ path: "src/a.ts", oid: "aaa" }] } } },
@@ -1449,7 +1419,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
["src/gone.ts", ""],
]);
// The head the reader is looking at, not whatever the source branch has moved on to.
// @effect-diagnostics-next-line preferSchemaOverJson:off
const body: unknown = JSON.parse(callAt(1).stdin ?? "{}");
expect(body).toMatchObject({
variables: { fullPath: "acme/web", ref: "head", paths: ["src/a.ts", "src/gone.ts"] },
@@ -1462,7 +1431,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
mockedExecute.mockReturnValueOnce(
Effect.succeed(
output(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({
iid: 7,
title: "t",
@@ -1480,10 +1448,7 @@ layer("GitLabPullRequestCli.layer", (it) => {
// these files, and reading it that way would report every file the reader has cleared as
// changed on nothing worse than a permission.
mockedExecute.mockReturnValueOnce(
Effect.succeed(
// @effect-diagnostics-next-line preferSchemaOverJson:off
output(JSON.stringify({ data: { project: null } })),
),
Effect.succeed(output(JSON.stringify({ data: { project: null } }))),
);
const cli = yield* GitLabPullRequestCli.GitLabPullRequestCli;
@@ -1520,7 +1485,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
mockedExecute.mockReturnValueOnce(
Effect.succeed(
output(
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify({
iid: 7,
title: "t",