Skip to content

Add missing documentation in testing.js#2399

Closed
itniuma2026 wants to merge 2 commits intoericcornelissen:mainfrom
itniuma2026:fix/issue-2396
Closed

Add missing documentation in testing.js#2399
itniuma2026 wants to merge 2 commits intoericcornelissen:mainfrom
itniuma2026:fix/issue-2396

Conversation

@itniuma2026
Copy link
Copy Markdown

Summary

Add JSDoc documentation to the methods in src/testing.js that are currently undocumented.

Approach

Examine the src/testing.js file and add JSDoc comments to all exported class methods that lack documentation. The documentation should follow the same patterns used in the main src/index.js (the Shescape class), describing parameters, return values, and thrown errors for methods like escape, escapeAll, quote, and quoteAll in the testing stubs (Shescape, Stubscape, Throwscape, etc.).

Files Changed

  • src/testing.js

Related Issue

Fixes #2396

Testing

No tests were added with this change. Happy to add them if needed.

Add JSDoc documentation to the methods in `src/testing.js` that are currently undocumented.

Fixes ericcornelissen#2396
@deepsource-io

This comment has been minimized.

@ericcornelissen ericcornelissen added the documentation Improvements or additions to documentation label Mar 5, 2026
@ericcornelissen ericcornelissen changed the title Fix #2396: Missing documentation in testing.js Add missing documentation in testing.js Mar 5, 2026
Copy link
Copy Markdown
Owner

@ericcornelissen ericcornelissen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets try to align the wording with the real Shescape JSdoc, while still being honest that these implementations do different things.

Comment thread src/testing.js
Comment on lines +89 to +90
* @param {object} [options] The options for escaping.
* @param {boolean | string} [options.shell] The shell to simulate.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be aligned with the docs for the Shescape constructor.

Suggested change
* @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.

Comment thread src/testing.js
}

/**
* Take a single value and escape any dangerous characters.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Take a single value and escape any dangerous characters.
* Take a single value, the argument, and pretend to escape it.

Comment thread src/testing.js
*
* @param {string} arg The argument to escape.
* @returns {string} The escaped argument.
* @throws {TypeError} If `arg` is not a stringable value.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @throws {TypeError} If `arg` is not a stringable value.
* @throws {TypeError} The argument is not stringable.

Comment thread src/testing.js
Comment on lines +108 to +109
* Take an array of values and escape any dangerous characters in every
* element.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 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.

Comment thread src/testing.js
Comment on lines +113 to +114
* @throws {TypeError} If `args` is not an array.
* @throws {TypeError} If any element of `args` is not a stringable value.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @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.

Comment thread src/testing.js
}

/**
* Take a single value, quote it, and escape any dangerous characters.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Take a single value, quote it, and escape any dangerous characters.
* Take a single value, the argument, and pretend to quote and escape it.

Comment thread src/testing.js
Comment on lines +126 to +127
* @throws {Error} If `shell` is set to `false`.
* @throws {TypeError} If `arg` is not a stringable value.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @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`.

Comment thread src/testing.js
Comment on lines +138 to +139
* Take an array of values, quote every element, and escape any dangerous
* characters in every element.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 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.

Comment thread src/testing.js
Comment on lines +143 to +145
* @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.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @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`.

Comment thread src/testing.js
/**
* Always throws an error.
*
* @param {object} [_options] The options (ignored).
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {object} [_options] The options (ignored).
* @param {object} [_options] The escape options.

@ericcornelissen
Copy link
Copy Markdown
Owner

@itniuma2026 are you open to addressing the requested changes?

@ericcornelissen
Copy link
Copy Markdown
Owner

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

abandoned documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing documentation in testing.js

2 participants