Add missing documentation in testing.js#2399
Add missing documentation in testing.js#2399itniuma2026 wants to merge 2 commits intoericcornelissen:mainfrom
testing.js#2399Conversation
Add JSDoc documentation to the methods in `src/testing.js` that are currently undocumented. Fixes ericcornelissen#2396
This comment has been minimized.
This comment has been minimized.
testing.jstesting.js
ericcornelissen
left a comment
There was a problem hiding this comment.
Lets try to align the wording with the real Shescape JSdoc, while still being honest that these implementations do different things.
| * @param {object} [options] The options for escaping. | ||
| * @param {boolean | string} [options.shell] The shell to simulate. |
There was a problem hiding this comment.
This should be aligned with the docs for the Shescape constructor.
| * @param {object} [options] The options for escaping. | |
| * @param {boolean | string} [options.shell] The shell to simulate. | |
| * @param {object} [options] The escape options. | |
| * @param {boolean | string} [options.shell=true] The shell to escape for. |
| } | ||
|
|
||
| /** | ||
| * Take a single value and escape any dangerous characters. |
There was a problem hiding this comment.
| * Take a single value and escape any dangerous characters. | |
| * Take a single value, the argument, and pretend to escape it. |
| * | ||
| * @param {string} arg The argument to escape. | ||
| * @returns {string} The escaped argument. | ||
| * @throws {TypeError} If `arg` is not a stringable value. |
There was a problem hiding this comment.
| * @throws {TypeError} If `arg` is not a stringable value. | |
| * @throws {TypeError} The argument is not stringable. |
| * Take an array of values and escape any dangerous characters in every | ||
| * element. |
There was a problem hiding this comment.
| * Take an array of values and escape any dangerous characters in every | |
| * element. | |
| * Take an array of values, the arguments, and pretend to escape every | |
| * argument. |
| * @throws {TypeError} If `args` is not an array. | ||
| * @throws {TypeError} If any element of `args` is not a stringable value. |
There was a problem hiding this comment.
| * @throws {TypeError} If `args` is not an array. | |
| * @throws {TypeError} If any element of `args` is not a stringable value. | |
| * @throws {TypeError} The arguments are not an array. | |
| * @throws {TypeError} One of the arguments is not stringable. |
| } | ||
|
|
||
| /** | ||
| * Take a single value, quote it, and escape any dangerous characters. |
There was a problem hiding this comment.
| * Take a single value, quote it, and escape any dangerous characters. | |
| * Take a single value, the argument, and pretend to quote and escape it. |
| * @throws {Error} If `shell` is set to `false`. | ||
| * @throws {TypeError} If `arg` is not a stringable value. |
There was a problem hiding this comment.
| * @throws {Error} If `shell` is set to `false`. | |
| * @throws {TypeError} If `arg` is not a stringable value. | |
| * @throws {TypeError} The argument is not stringable. | |
| * @throws {Error} Quoting is not supported with `shell: false`. |
| * Take an array of values, quote every element, and escape any dangerous | ||
| * characters in every element. |
There was a problem hiding this comment.
| * Take an array of values, quote every element, and escape any dangerous | |
| * characters in every element. | |
| * Take an array of values, the arguments, and pretend to quote and escape | |
| * every argument. |
| * @throws {Error} If `shell` is set to `false`. | ||
| * @throws {TypeError} If `args` is not an array. | ||
| * @throws {TypeError} If any element of `args` is not a stringable value. |
There was a problem hiding this comment.
| * @throws {Error} If `shell` is set to `false`. | |
| * @throws {TypeError} If `args` is not an array. | |
| * @throws {TypeError} If any element of `args` is not a stringable value. | |
| * @throws {TypeError} The arguments are not an array. | |
| * @throws {TypeError} One of the arguments is not stringable. | |
| * @throws {Error} Quoting is not supported with `shell: false`. |
| /** | ||
| * Always throws an error. | ||
| * | ||
| * @param {object} [_options] The options (ignored). |
There was a problem hiding this comment.
| * @param {object} [_options] The options (ignored). | |
| * @param {object} [_options] The escape options. |
|
@itniuma2026 are you open to addressing the requested changes? |
|
Closing this due a lack of responsiveness (in spite of the speed from issue-posted to pr-created, which was 6 minutes!) and a suspicion this is entirely LLM-generated (which I'm not necessarily against, but would explain the lack of a followup response). Please feel free to comment if you disagree and would still like to contribute :) |
Summary
Add JSDoc documentation to the methods in
src/testing.jsthat are currently undocumented.Approach
Examine the
src/testing.jsfile and add JSDoc comments to all exported class methods that lack documentation. The documentation should follow the same patterns used in the mainsrc/index.js(the Shescape class), describing parameters, return values, and thrown errors for methods likeescape,escapeAll,quote, andquoteAllin the testing stubs (Shescape, Stubscape, Throwscape, etc.).Files Changed
src/testing.jsRelated Issue
Fixes #2396
Testing
No tests were added with this change. Happy to add them if needed.