Skip to content

Commit 7f6328f

Browse files
committed
Fix cli input test
1 parent 3e31702 commit 7f6328f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/build_tests/cli_help/input.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const cliHelp =
1818
" clean Clean the build artifacts\n" +
1919
" format Format ReScript files\n" +
2020
" compiler-args Print the compiler arguments for a ReScript source file\n" +
21+
" compile-file Compile a single file and output JavaScript to stdout\n" +
2122
" help Print this message or the help of the given subcommand(s)\n" +
2223
"\n" +
2324
"Options:\n" +
@@ -88,6 +89,21 @@ const compilerArgsHelp =
8889
" -q, --quiet... Decrease logging verbosity\n" +
8990
" -h, --help Print help\n";
9091

92+
const compileFileHelp =
93+
"Compile a single file and output JavaScript to stdout\n" +
94+
"\n" +
95+
"Usage: rescript compile-file [OPTIONS] <PATH>\n" +
96+
"\n" +
97+
"Arguments:\n" +
98+
" <PATH> Path to a ReScript source file (.res or .resi)\n" +
99+
"\n" +
100+
"Options:\n" +
101+
" --module-format <MODULE_FORMAT> Module format to use (commonjs or esmodule). If not specified and multiple package-specs are configured, the first one is used with a warning\n" +
102+
" -v, --verbose... Increase logging verbosity\n" +
103+
" -q, --quiet... Decrease logging verbosity\n" +
104+
' --warn-error <WARN_ERROR> Override warning configuration from rescript.json. Example: --warn-error "+3+8+11+12+26+27+31+32+33+34+35+39+44+45+110"\n' +
105+
" -h, --help Print help\n";
106+
91107
/**
92108
* @param {string[]} params
93109
* @param {{ stdout: string; stderr: string; status: number; }} expected
@@ -216,3 +232,17 @@ await test(["compiler-args", "-h"], {
216232
stderr: "",
217233
status: 0,
218234
});
235+
236+
// Shows compile-file help with --help arg
237+
await test(["compile-file", "--help"], {
238+
stdout: compileFileHelp,
239+
stderr: "",
240+
status: 0,
241+
});
242+
243+
// Shows compile-file help with -h arg
244+
await test(["compile-file", "-h"], {
245+
stdout: compileFileHelp,
246+
stderr: "",
247+
status: 0,
248+
});

0 commit comments

Comments
 (0)