Skip to content

Commit 93f4412

Browse files
YousefEDclaude
andcommitted
fix: address PR review — lint fixes and setup.sh improvements
- Fix empty catch blocks (no-empty) and jest/valid-expect lint errors - Use --show-toplevel in setup.sh so worktrees resolve independently - Include package.json manifests in tarball cache hash Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f779c14 commit 93f4412

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

tests/nextjs-test-app/setup.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ set -e
77

88
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
99
TARBALLS_DIR="$SCRIPT_DIR/.tarballs"
10-
# Resolve the main repo root (works from git worktrees too).
11-
REPO_ROOT="$(cd "$(git -C "$SCRIPT_DIR" rev-parse --git-common-dir)/.." && pwd)"
10+
# Resolve the repo root (works from git worktrees too).
11+
REPO_ROOT="$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel)"
1212
PACKAGES_DIR="$REPO_ROOT/packages"
1313

14-
# Compute a hash of all package dist directories to detect changes.
14+
# Compute a hash of package dist directories + package.json manifests.
1515
HASH_FILE="$TARBALLS_DIR/.packages-hash"
16-
CURRENT_HASH=$(find "$PACKAGES_DIR/core/dist" "$PACKAGES_DIR/react/dist" "$PACKAGES_DIR/server-util/dist" "$PACKAGES_DIR/mantine/dist" -type f 2>/dev/null | sort | xargs cat 2>/dev/null | shasum -a 256 | cut -d' ' -f1)
16+
CURRENT_HASH=$( (find "$PACKAGES_DIR/core/dist" "$PACKAGES_DIR/react/dist" "$PACKAGES_DIR/server-util/dist" "$PACKAGES_DIR/mantine/dist" -type f 2>/dev/null | sort | xargs cat 2>/dev/null; cat "$PACKAGES_DIR/core/package.json" "$PACKAGES_DIR/react/package.json" "$PACKAGES_DIR/server-util/package.json" "$PACKAGES_DIR/mantine/package.json" 2>/dev/null) | shasum -a 256 | cut -d' ' -f1)
1717

1818
if [ -f "$HASH_FILE" ] && [ -d "$SCRIPT_DIR/node_modules/@blocknote/core" ] && [ "$(cat "$HASH_FILE")" = "$CURRENT_HASH" ]; then
1919
echo "Tarballs up to date, skipping pack+install"

tests/src/unit/nextjs/serverUtil.test.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,18 @@ describe(`server-util in Next.js App Router (#942) [${MODE}]`, () => {
114114
try {
115115
errorMessage =
116116
JSON.parse(nextDataMatch[1])?.err?.message || errorMessage;
117-
} catch {}
117+
} catch {
118+
// ignore invalid JSON
119+
}
118120
}
119121
throw new Error(errorMessage);
120122
}
121-
expect(res.status, `Response: ${JSON.stringify(body)}`).toBe(200);
122-
expect(
123-
body.allPassed,
124-
`Failed results: ${JSON.stringify(body.results, null, 2)}`,
125-
).toBe(true);
123+
expect(res.status).toBe(200);
124+
if (!body.allPassed) {
125+
throw new Error(
126+
`Failed results: ${JSON.stringify(body.results, null, 2)}`,
127+
);
128+
}
126129

127130
// Verify individual results match ReactServer.test.tsx scenarios
128131
expect(body.results.simpleReactBlock).toMatch(/^PASS:/);
@@ -144,7 +147,9 @@ describe(`server-util in Next.js App Router (#942) [${MODE}]`, () => {
144147
if (nextDataMatch) {
145148
try {
146149
errorDetail = JSON.parse(nextDataMatch[1])?.err?.message;
147-
} catch {}
150+
} catch {
151+
// ignore invalid JSON
152+
}
148153
}
149154
if (!errorDetail && digestMatch) {
150155
errorDetail = `digest: ${digestMatch[1]}`;

0 commit comments

Comments
 (0)