Skip to content

Commit db5808f

Browse files
Copilotnvuillam
andcommitted
Address code review feedback: improve test names and CLI flag parsing
Co-authored-by: nvuillam <17500430+nvuillam@users.noreply.github.com>
1 parent 9df3719 commit db5808f

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

lib/cli.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,17 @@ class JavaCallerCli {
2727
const args = [...process.argv];
2828
args.splice(0, 2);
2929

30-
// Parse --no-windows-hide flag
30+
// Parse --no-windows-hide flag (remove all occurrences)
3131
const runOptions = {};
32-
const noWindowsHideIndex = args.indexOf('--no-windows-hide');
33-
if (noWindowsHideIndex !== -1) {
34-
runOptions.windowsHide = false;
35-
args.splice(noWindowsHideIndex, 1);
36-
}
32+
const filteredArgs = args.filter(arg => {
33+
if (arg === '--no-windows-hide') {
34+
runOptions.windowsHide = false;
35+
return false; // Remove from args
36+
}
37+
return true; // Keep in args
38+
});
3739

38-
const { status } = await java.run(args, runOptions);
40+
const { status } = await java.run(filteredArgs, runOptions);
3941
process.exitCode = status;
4042
}
4143
}

test/java-caller.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ describe("Call with classes", () => {
6868
checkStdOutIncludes(`JavaCallerTester is called !`, stdout, stderr);
6969
});
7070

71-
it("should call JavaCallerTester.class with windowsHide set to true (default)", async () => {
71+
it("should call JavaCallerTester.class with windowsHide explicitly set to true", async () => {
7272
const java = new JavaCaller({
7373
classPath: 'test/java/dist',
7474
mainClass: 'com.nvuillam.javacaller.JavaCallerTester'

0 commit comments

Comments
 (0)