Skip to content

Commit 16190b4

Browse files
coderabbitai[bot]CodeRabbit
andauthored
fix: apply CodeRabbit auto-fixes
Fixed 3 file(s) based on 1 failed pre-merge check. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
1 parent 8941c87 commit 16190b4

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

‎tests/codegen-deno/deno_scripting.harness.mjs‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const fs = {
2727
};
2828

2929
const fsStub = {
30+
/** Returns the in-memory `fs` entries for `path` as Dirent-like objects, or throws ENOENT. */
3031
readdirSync: (path) => {
3132
const entries = fs[path];
3233
if (!entries) {
@@ -40,17 +41,24 @@ const fsStub = {
4041
isDirectory: () => e.isDirectory,
4142
}));
4243
},
44+
/** No-op stand-in; this corpus never asserts on directory creation. */
4345
mkdirSync: () => {},
46+
/** No-op stand-in; this corpus never asserts on file writes. */
4447
writeFileSync: () => {},
48+
/** No-op stand-in; this corpus never asserts on file removal. */
4549
rmSync: () => {},
50+
/** Returns an empty buffer; this corpus never asserts on file contents. */
4651
readFileSync: () => new Uint8Array(),
52+
/** Always throws ENOENT; this corpus never exercises a successful stat. */
4753
statSync: (path) => {
4854
const err = new Error(`stub: no such path ${path}`);
4955
err.code = "ENOENT";
5056
throw err;
5157
},
5258
};
5359

60+
// Intercepts the Bun-ESM prelude's lazy `node:fs` resolution so `fsStub`
61+
// backs the emitted FS calls; delegates any other builtin to the real host.
5462
const realGetBuiltinModule = process.getBuiltinModule?.bind(process);
5563
process.getBuiltinModule = (name) => {
5664
if (name === "node:fs") return fsStub;
@@ -65,6 +73,7 @@ process.getBuiltinModule = (name) => {
6573
const realArgv = process.argv;
6674
process.argv = ["node", "deno_scripting.harness.mjs", "alpha", "beta", "gamma"];
6775
let lastExit = null;
76+
/** Captures the exit code instead of terminating the harness process. */
6877
process.exit = (code) => { lastExit = code; };
6978

7079
// Capture stderr writes from consoleError.

‎tests/codegen-deno/deno_scripting_part2.harness.mjs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const files = {
1818
};
1919

2020
const fsStub = {
21+
/** Returns size/isFile/isDirectory for a known path, or throws ENOENT. */
2122
statSync: (path) => {
2223
const e = files[path];
2324
if (!e) {
@@ -31,6 +32,7 @@ const fsStub = {
3132
isDirectory: () => e.kind === "dir",
3233
};
3334
},
35+
/** Returns the stubbed bytes for a known file path, or throws ENOENT. */
3436
readFileSync: (path) => {
3537
const e = files[path];
3638
if (!e || e.kind !== "file") {
@@ -42,6 +44,8 @@ const fsStub = {
4244
},
4345
};
4446

47+
// Intercepts the Bun-ESM prelude's lazy `node:fs` resolution so `fsStub`
48+
// backs the emitted FS calls; delegates any other builtin to the real host.
4549
const realGetBuiltinModule = process.getBuiltinModule?.bind(process);
4650
process.getBuiltinModule = (name) => {
4751
if (name === "node:fs") return fsStub;

‎tools/run_codegen_bun_tests.sh‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ if ! command -v bun >/dev/null 2>&1; then
2424
fi
2525

2626
failures=()
27+
# Records a check failure and echoes it as a `::error::` annotation, without
28+
# aborting the script, so later checks still run (fail-late).
2729
fail() {
2830
failures+=("$1")
2931
echo "::error::$1" >&2

0 commit comments

Comments
 (0)