{"name":"treport","description":"Reporters for node-tap","version":"3.0.4","author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"https://izs.me"},"dependencies":{"@isaacs/import-jsx":"^4.0.1","cardinal":"^2.1.1","chalk":"^3.0.0","ink":"^3.2.0","ms":"^2.1.2","tap-parser":"^11.0.0","tap-yaml":"^1.0.0","unicode-length":"^2.0.2"},"peerDependencies":{"react":"^17.0.2"},"devDependencies":{"events-to-array":"^1.1.2","ink-testing-library":"^2.1.0","minipass":"^3.1.1","react":"^17.0.2","tap":"^15.2.2"},"license":"ISC","scripts":{"test":"tap","snap":"tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags"},"tap":{"jsx":true,"test-env":["TERM_PROGRAM=iTerm.app","TERM=xterm-256color","TERM_PROGRAM_VERSION=3.2.7","COLORTERM=truecolor","FORCE_COLOR=1"],"coverage-map":"map.js"},"nyc":{"all":true,"include":["index.js","lib/**/!(*.test).js"]},"main":"index.js","repository":{"type":"git","url":"git://github.com/tapjs/treport.git"},"gitHead":"054fbd154f3bdf8deeca01900052079c9e94e95d","bugs":{"url":"https://github.com/tapjs/treport/issues"},"homepage":"https://github.com/tapjs/treport#readme","_id":"treport@3.0.4","_nodeVersion":"18.4.0","_npmVersion":"8.13.2","dist":{"integrity":"sha512-zUw1sfJypuoZi0I54woo6CNsfvMrv+OwLBD0/wc4LhMW8MA0MbSE+4fNObn22JSR8x9lOYccuAzfBfZ2IemzoQ==","shasum":"05247fa7820ad3afe92355e4cf08fe41a933084b","tarball":"http://registry-npm.ywwl.com/treport/download/treport-3.0.4.tgz","fileCount":36,"unpackedSize":53146,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCHj3gFHX3c/v4N2C6uso+5LER3WXw2lWdpJxTe1UggzwIhANYZXsGKNCHBdKzhnNxO2oV2G5dMhXWZGzlt0PmiMHqL"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiwx5uACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmotPhAAmYf1/1Mu9YvE+A3r0ZaBv47Dky+VuQRBwNiAVS7u6E4HXgn1\r\nCzzGEGvzrTKr0l+95kGh96FkQGfbh+w7YGLJF2nln3ClaosomrHv1UcSX2Di\r\nyPcDD7xUDScm4wUkXBAdFvDnsRz+J8YdyiVCbFzuRfiITWd0otvUYxnPp42s\r\nuYWW2E6nJnZBVuikdHLKd4Gf0G7EAEuQwAw22y8RvyJSHB4apSYN+uK/t3D3\r\nNw13Ixl/bo9QjpFFlC0QgOofZF7aLhCFSu+JvadK1l02Apymv5+x2RPVClJB\r\n4o5rqM3MfuonvHpEFk2ZoztGoRTzg+q0fUL7lc7fcHMshvpcNjI0UkXzPZ2J\r\nfLM1Qe1XDxBg2J7VIk32lWO7ZJRWmIRVtzCC9++wOFurrSVXoM6jEKzvrGG9\r\n2PgUfj2rXNJR03RYDW+blU7P+3p9u2qPZSUspllpmuJnBjEaU1r0RzwKoyUD\r\nM28Ltsr0FN2NBoGKnbRRoSjnRDWBF8eP+2iofOeiHwhzQMncuAcCDavB+9gm\r\nvhGTcZEN2oO+TyVBmDBNt5i/oB3Ebze+H/QfCxVBM/LJo0ozGmFiQKR39BRk\r\ny2Kww7rbIy362GT1yFBJbDRQl2sjzQMrn/d14oad9W0kyZ0BvMzsW9ClLqxG\r\nKxtpouUpaf1QdXpTTKZ9VE+bDxzfDzK45RI=\r\n=H5IJ\r\n-----END PGP SIGNATURE-----\r\n","size":16039,"noattachment":false,"key":"/treport/-/treport-3.0.4.tgz"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"directories":{},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/treport_3.0.4_1656954478108_0.12552946152394684"},"_hasShrinkwrap":false,"readme":"# treporter\n\nReporters for node-tap\n\nAn [ink](http://npm.im/ink)-based reporter for use with\n[tap](http://npm.im/tap) version 13 and higher.\n\n## Built-in Report Types\n\n### Base\n\nThe default, and the class to extend to create new reporters.  Does all the\nthings, handles all the edge cases, and ends with a pleasant surprise.\n\n### Terse\n\nA lot like Base, but says a lot less.  No timer, no list of tests concurrently\nrunning, nothing printed on test passing.  Just the failures and the terse\nsummary.\n\n### Specy\n\nA `spec` style reporter with the current running jobs and Terse summary and\nfooter.\n\n## Extending\n\nYou can extend this by creating a module whose main `module.exports` is a\nchild class that extends the `treport.Base` class (which in turn extends\n`React.Component`).\n\n```js\nconst React = require('react')\nconst {Base} = require('treport')\nclass MyTreportBasedTapReporter extends Base {\n  // my stuff...\n}\nmodule.exports = MyTreportBasedTapReporter\n```\n\nTo use your module as the test reporter, you'd do this:\n\n```\nnpm install -D my-treport-based-tap-reporter\ntap --reporter=my-treport-based-tap-reporter\n```\n\nTap will `require()` that module, see it's a `React.Component`, and use it\nwith ink.\n\nYour child class will get its `constructor()` called with `{tap:tap}`,\nwhich is the root tap object for the test runner.\n\nIt can override the `render()` method, or anything else.  In most cases, you\nwill likely want to override just part of the class, or one of the tags used\nfor the layout, but the sky is the limit.  A child class could also modify the\ndata being tracked, but leave the tags untouched.\n\nThe following methods describe each of the class methods that can be\noverridden.\n\n### render()\n\nThe main rendering entry point, as is the React custom.  The Base class\nreturns:\n\n```jsx\n<Box flexDirection=\"column\">\n  <this.Log log={this.state.log} />\n  <this.Runs runs={this.state.runs} />\n  { this.state.results ? (\n      <this.Summary\n        results={this.state.results}\n        tests={this.state.tests} />\n    )\n    : '' }\n  <this.Footer\n    suiteCounts={suiteCounts}\n    assertCounts={assertCounts}\n    time={time} />\n</Box>\n```\n\nOne of the easiest ways to change the look and feel of the test reporter is to\nswap out these components.\n\n### get Log()\n\nA getter function that returns the React component for the \"log\" section.  This\nsection gets failure/todo/skip results pushed into it, as well as the final\npass/fail/todo/skip result for tests when they complete.  Typically, it should\nuse a `<Static>` tag, since this will often get much longer than the height of\nthe terminal window, and you want to be able to see the results.\n\nSee `state.log` below for more info.\n\n### get Runs()\n\n- `runs` Array of Test objects\n\nA getter function that returns the React component for the \"runs\" section.\n`this.state.runs` is a list of the tests currently in progress.\n\n### get Summary()\n\nThis is a section that shows when the test run is fully completed.  It shows a\npretty banner with rainbows, along with any tests that failed, or are marked as\nskip or todo.\n\n### get Footer()\n\nThis is a section that shows the count of test suites (ie, processes) queued\nand completed, a count of assertions completed, and a timer so you can see how\nlong the test is running for.\n\n## State Properties\n\nThe reporter keeps the following state properties up to date as the test\nproceeds:\n\n### this.state.log\n\nArray of log objects.  Each is one of the following types:\n\n- `{ raw: <String> }` just a plain old string.\n- `{ res: {ok, name, diag, todo, skip, testName} }` A test point\n- `{ test: [Test Object] }` A test that has completed\n\n### this.state.tests\n\nAll tests are added to this array.  In the event of a bailout, everything other\nthan the bailing-out test is removed, so that the Summary output isn't\ncluttered up with a bunch of spurious failures.\n\n### this.state.runs\n\nArray of tests currently running.  (When not running in parallel mode, this is\nalways a single item.)\n\n### this.state.results\n\nThe `tap.results` object at the end of the test run.\n\n### this.state.assertCounts\n\nCounts of all assertions run in all tests. `{total, pass, fail, skip, todo}`\n\nIn order to avoid overwhelming the display, updates to assertion counts are\ndebounced so that they are not updated more than once every 50ms.\n\n### this.state.suiteCounts\n\nJust like `assertCounts`, but for test suites, and not debounced.\n\n### this.state.time\n\nTotal elapsed time in ms since the test run started.\n\n### this.state.bailout\n\nWhen a bailout occurs, this is set to the bailout reason, or `true` if no\nreason is given.\n\n### this.start\n\nThe `Date.now()` when the test run started.\n\n### this.assertCounts\n\nUpdated on each test assertion.  Matched to `this.state.assertCounts` at most\nonce every 50ms.\n\n### constructor()\n\nThe constructor receives `tap` as an argument, initializes state, and assigns\nappropriate event handlers to keep state up to date.  Then, the\n`this.tapResume(tap)` method is called to resume and discard the TAP output\nfrom the test harness, since the reporter gets everything it needs from the\nevents and child test objects.\n\n### tapResume(tap)\n\nOverride to prevent the `tap` object from being resumed when calling the Base\nconstructor.\n\n### get time()\n\nCalled to get the current running time.\n\n### bailout(bailout, test = null)\n\nCalled when a test bails out.  If `test` is set to null, then that means that\nthe root Tap test is bailing out independently of any child test.  (This is\nunusual.)\n\n### inc(type)\n\nCalled on each assertion to increment `this.assertCounts` and\n`this.state.assertCounts`.\n\n### addTest(test)\n\nCalled whenever a new test is added to the queue (but before it has started\nrunning).\n\n### startTest(test)\n\nCalled when a test starts.\n\n### endTest(test)\n\nCalled when a test ends.\n\n### endAll(tap)\n\nCalled when the main all tests are done and the tap test runner completes.\n\n### logRes(test, res)\n\nCalled when a fail/todo/skip result is emitted from a test, and pushes it onto\nthe log.\n\n### onRaw(test, fd)\n\nReturns a handler to take all the non-TAP data from a child test, so that it\ncan be printed to the log with a helpful prefix.  In the Base test class, this\nprefixes with the name of the test and the file descriptor printed to.\n\nSo, for example, a test named `test/foo.js` would have its stderr output\nprefixed with `test/foo.js 2> ...` and its stdout output prefixed with\n`test/foo.js 1> ...`.\n","publish_time":1656954478312,"_cnpm_publish_time":1656954478312,"dist-tags":{"latest":"3.0.4"}}