Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[readme] improve t.throws/t.doesNotThrow documentation #541

Merged
merged 1 commit into from Jan 19, 2021
Merged

[readme] improve t.throws/t.doesNotThrow documentation #541

merged 1 commit into from Jan 19, 2021

Conversation

cagross
Copy link
Contributor

@cagross cagross commented Jan 18, 2021

Hi Jordan,

Sorry for the delay on this. Per our discussion (in issue #540), in this commit I have edited the README to describe the following:

  • The behavior of t.throws() when the expected parameter is a string.
  • The fact that the expected parameter for t.throws() can be a validation object (just like Node's assert.throws()).

Have a look and let me know if anything is incomplete or inaccurate.

For now, due to time constraints, I omitted an example of validation object usage, and simply added a link to the Node documentation. I'd very much like to add such an example (as they've done on the Node documentation page), but I'm out of time today, and might get busy with work tomorrow for the next week or so. I can try to keep you posted here on that schedule. But it may be the case where you want to merge these edits now, and I open a new pull request next week which adds the validation object example.

Two more questions that we might want to address now (or earmark for future discussion):

  1. Are there files other than the README that should be updated with this information? If so, I can do that if you want (either in this pull request or a separate pull request in the future).

  2. In the README, should other methods be updated with similar information? i.e. are there other methods with an expected parameter that cannot be a string? If so, I can do that if you want (either in this pull request or a separate pull request in the future).

--Carl

* Described method behavior when "expected" parameter is a string.

* `throws`: Described method behavior when "expected" parameter is an object (i.e. validation object).

* Added usage example for when expected parameter is a regex.

Fixes #540.
@codecov-io
Copy link

codecov-io commented Jan 18, 2021

Codecov Report

Merging #541 (84fcf48) into master (3b924b0) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #541   +/-   ##
=======================================
  Coverage   74.15%   74.15%           
=======================================
  Files          19       19           
  Lines         766      766           
  Branches      146      146           
=======================================
  Hits          568      568           
  Misses        198      198           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3b924b0...84fcf48. Read the comment docs.

Copy link
Collaborator

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

Thanks, this looks great! Mind making the same changes to doesNotThrow, just below?

(There aren't any other files to update; and other than throws/doesNotThrow, let's save additional updates for another PR)

@cagross
Copy link
Contributor Author

cagross commented Jan 19, 2021

Mind making the same changes to doesNotThrow, just below?

OK sure. Give me 24 hours and I'll push a new commit to this PR.

(There aren't any other files to update; and other than throws/doesNotThrow, let's save additional updates for another PR)

OK noted on all.

@cagross
Copy link
Contributor Author

cagross commented Jan 19, 2021

OK I just pushed a second commit with the edits to t.doesNotThrow(). I omitted the validation object as an allowed value for expected, since Node's doesNotThrow does not allow it as a parameter. I hope that was correct. If not let me know and I can add it back in.

I also added some of the existing verbiage from t.doesNotThrow() to t.throws() because it looked helpful (specifically the regex usage example). Let me know if I did so incorrectly.

@ljharb ljharb changed the title Augment t.throws() section of README. [readme] improve t.throws/t.doesNotThrow documentation Jan 19, 2021
@ljharb ljharb merged commit 84fcf48 into tape-testing:master Jan 19, 2021
@cagross
Copy link
Contributor Author

cagross commented Jan 20, 2021

Great! Give me a few more days and I'll add that validation object example we discussed.

If new issues are submitted related to this area, feel free to tag me (or this PR, or my commits, or whatever), and I can take a look.

@cagross cagross deleted the readme-throws branch January 26, 2021 12:48
ljharb added a commit that referenced this pull request Feb 20, 2021
 - [New] add `.teardown()` on `t` instances (#546)
 - [readme] improve `t.throws` documentation (#542)
 - [readme] improve `t.throws`/`t.doesNotThrow` documentation (#541)
 - [Deps] update `call-bind`, `is-regex`, `resolve`
 - [Dev Deps] update `eslint`, `aud`
 - [Tests] exclude node v0.6, for now
ljharb added a commit that referenced this pull request Jul 28, 2021
 - [New] add `.teardown()` on `t` instances (#546)
 - [New] Include name of test in log when test times out (#524)
 - [Refactor] avoid reassigning arguments
 - [Refactor] remove unused line, unneeded var initialization; add missing `new`
 - [Refactor] remove use of legacy `exports`
 - [Refactor] Avoid setting message property on primitives; use strict mode to catch this
 - [Refactor] generalize error message from calling `.end` more than once
 - [Refactor] use `call-bind/callBound` instead of `function-bind` directly
 - [readme] improve `t.throws` documentation (#541)
 - [readme] Another way to create custom reportersA (#556)
 - [readme] remove long-dead testling-ci badge
 - [readme] add `tape-describe` to 'other' section (#523)
 - [readme] remove travis badge; add actions and codecov badges
 - [eslint] remove useless regex escapes
 - [eslint] fully enable `@ljharb` eslint config
 - [meta] do not publish github action workflow files
 - [meta] add `safe-publish-latest`; use `prepublishOnly` script for npm 7+
 - [meta] run `aud` in `posttest`
 - [Deps] update `glob`, `is-regex`, `object-inspect`, `resolve`, `string.prototype.trim`
 - [Dev Deps] update `eslint`
 - [actions] use `node/install` instead of `node/run`; use `codecov` action
 - [Tests] exclude examples from coverage
 - [Tests] ensure bin/tape is linted
 - [Tests] make `stripFullStack` output an array of lines, for better failure messages
 - [Tests] handle stack differences in node 15
 - [Tests] add test case for #519 for test.comment() in createStream/objectMode context
ljharb added a commit that referenced this pull request Jul 28, 2021
v4.14.0

 - [New] add `.teardown()` on `t` instances (#546)
 - [New] Include name of test in log when test times out (#524)
 - [Refactor] avoid reassigning arguments
 - [Refactor] remove unused line, unneeded var initialization; add missing `new`
 - [Refactor] remove use of legacy `exports`
 - [Refactor] Avoid setting message property on primitives; use strict mode to catch this
 - [Refactor] generalize error message from calling `.end` more than once
 - [Refactor] use `call-bind/callBound` instead of `function-bind` directly
 - [readme] improve `t.throws` documentation (#541)
 - [readme] Another way to create custom reportersA (#556)
 - [readme] remove long-dead testling-ci badge
 - [readme] add `tape-describe` to 'other' section (#523)
 - [readme] remove travis badge; add actions and codecov badges
 - [eslint] remove useless regex escapes
 - [eslint] fully enable `@ljharb` eslint config
 - [meta] do not publish github action workflow files
 - [meta] add `safe-publish-latest`; use `prepublishOnly` script for npm 7+
 - [meta] run `aud` in `posttest`
 - [Deps] update `glob`, `is-regex`, `object-inspect`, `resolve`, `string.prototype.trim`
 - [Dev Deps] update `eslint`
 - [actions] use `node/install` instead of `node/run`; use `codecov` action
 - [Tests] exclude examples from coverage
 - [Tests] ensure bin/tape is linted
 - [Tests] make `stripFullStack` output an array of lines, for better failure messages
 - [Tests] handle stack differences in node 15
 - [Tests] add test case for #519 for test.comment() in createStream/objectMode context
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants