{"name":"treport","description":"Reporters for node-tap","version":"3.0.3","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","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.1.6"},"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":"819b0f360c382c14b5fe4b26e66b51f74da7f0f8","bugs":{"url":"https://github.com/tapjs/treport/issues"},"homepage":"https://github.com/tapjs/treport#readme","_id":"treport@3.0.3","_nodeVersion":"17.6.0","_npmVersion":"8.5.3","dist":{"integrity":"sha512-pCg4Bc0Uv0ntAkYjYJAncA6h6Srv1eEFa5vcak8paahgU1TrJ2rZm0RPZ8E8uycz+P55quzsDnACw01jpWfk7Q==","shasum":"0666bb1b00b6ed6e2ba82ae76b79d77fb03c505a","tarball":"http://registry-npm.ywwl.com/treport/download/treport-3.0.3.tgz","fileCount":36,"unpackedSize":53120,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiIwbSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp0Pg/+MtFGi0N//Ourq2BayTMr6ncy4sDsjl2GQ+jmQBsI46nxKO08\r\nuBiVev4Mqiov2a1HlB0ukB7FTd6qSNI9fj8bNUVBgbyRox59hNHGwSzYRoLj\r\nNhzUPIJtc8rsJd7gnxKhpEXa/ug7OXhkZ5SX11hjyrxxT5Stw/AJR/4Tyr0U\r\nYJdYUzGFfx8k5tfPASW7FRPKdsbundBPP8IjsUKAmgQD4rM5B9As6dToKkXZ\r\nwsLoZJnYG6ddwyTIAMrDTxzSbqPXYGGU/anysKA37xdCTeioQSR8dx7xp42a\r\nRKMHuGUap4S7Bmtkd9nvpKbnyJCp5iNoKWYYcVbYCuBQu1x0hq3bsvr17U1o\r\nA2ItU0x/xNHEzkyVsWkT/R6StAK69Fg5krktnvqx2nldekztN3D7a2NSG1ra\r\nkd4Sirb1tgxdXWcqRxi5WZQ5mlBQPkBqfUriL00IhXzpF3g139oJ2+vsUmEw\r\nfPM98gElClu3x4qeQACjgZChnQODItfrZX38VpfaxttY+a8/txK1m7e7jQCL\r\nbZyEJ0gi2/OYI3Y5EUPL93/DsE7vAcxHJ35sZmHkNhaK5dJwt1+0XATS5JrK\r\nRRLWnLxyH3poHRBXxNTy1OIvreI+sGy8apQVQ42m3923ymoNS9oTyKQSXK9z\r\nJW+YIXxbF7C2Ysz0CHt8kaes5ENfW62D5a0=\r\n=ZW19\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCKetI3EKGovmfVM1LQUxOIenfpYpM1NDAdO4wRsaR+xQIhANdFG8aur98/JydHPr5TCGwZd5iIFiij57e8m/H94a/s"}],"size":16032,"noattachment":false,"key":"/treport/-/treport-3.0.3.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.3_1646462674810_0.9586976158984535"},"_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":1646462674952,"_cnpm_publish_time":1646462674952,"dist-tags":{"latest":"3.0.4"}}