-
-
Notifications
You must be signed in to change notification settings - Fork 305
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
Could use a diag() Method #91
Comments
👍 We should also look at Test::More or Test.More and take more inspiration from PERL. |
Test.More is a pretty direct port of the Perl module, FWIW. I wrote it a long time ago… |
i think the way to add this is to add it to lib/test.js as a Then in lib/results.js we just need to listen to diag events |
FWIW, instead of copying the behavior of other implementations verbatim, there is renewed discussion around finalizing the TAP IETF RFC and adding some proposed features to version 14. @Ovid has been doing new work in this space in the perl community. Check out the new discussions from the last few days here: that being said, I totally agree that we could use a |
Also, related to this is the TAP Y/J specification that is worth looking at. Right now, version 13 only specifies YAML matter between TestAnything/testanything.github.io#6 |
@malandrew @substack We should do a tape hack day some time to fix up various little things (with lots of those tests) |
@Raynos I would actually love to actually spend time with both Consolidating the efforts, cleaning up these outstanding issues and adding better documentation to One thing I'd really like to explore is using TAP for local "CI assistance". i.e. If I made library A and libraries B and C depend on A, it would be interesting to not only run my tests, but also the tests of my dependents, diffing the test results from those dependents using the previous version of A and the current version of A. This is super valuable information for helping the maintainers of B and C upgrade their dependencies and helping library builders know decide whether to (a) do a minor or possibly even a major semver bump because their changes breaks their dependents, or (b) inform the maintainers of their dependents that their semver ranges are too loose. |
@malandrew +1! |
While a diag() method is useful, you might also want to consider the extremely useful explain() function. explain() is similar to diag(), but it only runs in when the test harness is running in verbose mode. This can be invaluable when you don't want your test output cluttered with a bunch of diagnostics that don't really apply to the pass/fail nature of the entire test suite. explain() is used when you have things like this (pseudo-code): client.get_ok("/path/to/a/web/page")
In the above example, if the get_ok() call fails, explain() dumps a data structure showing the client status and the visible html (e.g., what a human would see). That could be a huge amount of output, but for a full test suite run, all that extra output is noisy and can make it hard to see what you're looking for. If tests are run in non-verbose mode, calling explain() is a no-op. For diag(), there are times that you want diagnostic information visible even when the full test suite is run. For example: diag("The following tests are very fragile. Fix them!");
Best, OvidIT consulting, training, international recruiting On Tuesday, 12 August 2014, 23:07, Andrew de Andrade notifications@github.com wrote:
|
@Ovid I really like the idea of an I also agree with your description of when i.e. I want an assertion to pass if, over N runs, it completes faster than than X milliseconds with a standard deviation not greater than Y% of X. In some cases I may want to only show performance metrics when the test fails. In other cases, where I am trying to determine performance gains between versions, I might want to always display perf yaml data so that the figures can be compared between runs to make sure your library is alway getting faster. |
It's pretty typical for TAP implementations to offer an interface for emitting diagnostic messages as TAP comments. Examples:
I tried to figure out where to plug one in to submit a patch, but the path to the output handle was over my head, so I used
console.log()
for my immediate use. Would be nice to have a canonical place for it.The text was updated successfully, but these errors were encountered: