{"name":"tape","version":"5.10.1","keywords":["tap","test","harness","assert","browser"],"author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"license":"MIT","_id":"tape@5.10.1","maintainers":[{"name":"ljharb","email":"ljharb@gmail.com"},{"name":"domenic","email":"d@domenic.me"},{"name":"raynos","email":"raynos2@gmail.com"}],"homepage":"https://github.com/tape-testing/tape","bugs":{"url":"https://github.com/tape-testing/tape/issues"},"bin":{"tape":"bin/tape"},"dist":{"shasum":"a51ff78d929fa4ba80baab55d8621a3909c5d3a5","tarball":"http://registry-npm.ywwl.com/tape/download/tape-5.10.1.tgz","fileCount":175,"integrity":"sha512-cre3VCO4HIc7PSodPWwdLfX1RLUw0IAMVQV8M+erGkLKJ2N2lyxVVqSdRCJL2xM/6o3/3xxwv/QwYr7bRHSquA==","signatures":[{"sig":"MEUCIAksnFGn4F+KFjZSaNpdnETjP6/wJ7lx8ykMOPuXfoFkAiEAlTJPR3rBGpdvPs3708Tef64JqD4zNBjD+0sdGJsjdTo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":476021,"size":111623,"noattachment":false,"key":"/tape/-/tape-5.10.1.tgz"},"main":"index.js","types":"./index.d.ts","browser":{"fs":false},"exports":{".":"./index.js","./lib/test":"./lib/test.js","./lib/results":"./lib/results.js","./package.json":"./package.json","./lib/default_stream":"./lib/default_stream.js"},"funding":{"url":"https://github.com/sponsors/ljharb"},"gitHead":"c4a7b4a095df54211d77ef63b8054a151260dbfd","scripts":{"lint":"eslint .","test":"npm-run-posix-or-windows tests-only","eclint":"FILES=\"$(npm run --silent prelint:files)\" eclint check \"${FILES:=package.json}\"","prelint":"npm-run-posix-or-windows eclint","prepack":"npmignore --auto --commentLines=autogenerated","pretest":"npm run lint","version":"auto-changelog && git add CHANGELOG.md","postlint":"tsc && attw -P","posttest":"npx npm@'>=10.2' audit --production","prepublish":"not-in-publish || npm run prepublishOnly","tests-only":"cross-env NODE_OPTIONS='--no-warnings' nyc tap 'test/*.js'","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"","test:example":"find example -name '*.js' | grep -v fail | grep -v static | xargs tap","prelint:files":"git ls-files 2>/dev/null | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' || echo '*.md *.js test/*.js'","eclint:windows":"eclint check *.js","prepublishOnly":"safe-publish-latest","tests-only:windows":"cross-env NODE_OPTIONS='--no-warnings' nyc node_modules\\tap\\bin\\run.js test/*.js"},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com","approver":{"name":"ljharb","email":"ljharb@gmail.com"}},"testling":{"files":"test/browser/*.js","browsers":["ie/6..latest","chrome/20..latest","firefox/10..latest","safari/latest","opera/11.0..latest","iphone/6","ipad/6"]},"repository":{"url":"git://github.com/tape-testing/tape.git","type":"git"},"_npmVersion":"11.16.0","description":"tap-producing test harness for node and browsers","directories":{"test":"test","example":"example"},"sideEffects":false,"_nodeVersion":"26.3.0","dependencies":{"glob":"^7.2.3","hasown":"^2.0.4","defined":"^1.0.1","resolve":"^2.0.0-next.7","for-each":"^0.3.5","inherits":"^2.0.4","is-regex":"^1.2.1","minimist":"^1.2.8","call-bind":"^1.0.9","dotignore":"^0.1.2","object-is":"^1.1.6","call-bound":"^1.0.4","deep-equal":"^2.2.3","@ljharb/now":"^1.0.1","object-keys":"^1.1.1","mock-property":"^1.1.0","object.assign":"^4.1.7","object-inspect":"^1.13.4","@ljharb/resumer":"^0.1.3","@ljharb/through":"^2.3.14","es-object-atoms":"^1.1.2","get-package-type":"^0.1.0","has-dynamic-import":"^2.1.1","array.prototype.every":"^1.1.7","string.prototype.trim":"^1.2.11"},"publishConfig":{"ignore":[".github/workflows","types"]},"_hasShrinkwrap":false,"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","hideCredit":true,"unreleased":false,"commitLimit":false,"backfillLimit":false},"devDependencies":{"nyc":"^10.3.2","tap":"^8.0.1","jiti":"^0.0.0","eclint":"^2.8.1","eslint":"^10.4.1","semver":"^6.3.1","falafel":"^2.2.5","js-yaml":"^3.14.0","ecstatic":"^4.1.4","cross-env":"^2.0.1","jackspeak":"=2.1.1","npmignore":"^0.3.5","@types/tap":"^14.10.3","tap-parser":"^5.4.0","typescript":"next","@types/node":"^12.20.55","@types/semver":"^6.2.7","concat-stream":"^1.6.2","@types/defined":"^1.0.2","@types/falafel":"^2.2.2","@types/js-yaml":"^3.12.10","auto-changelog":"^2.6.0","@types/inherits":"^2.0.0","@ljharb/tsconfig":"^0.3.2","@types/call-bind":"^1.0.5","@types/object-is":"^1.1.0","@types/deep-equal":"^1.0.4","es-value-fixtures":"^1.7.1","@types/object-keys":"^1.0.3","safe-publish-latest":"^2.0.0","@types/concat-stream":"^2.0.3","@types/object.assign":"^4.1.0","@arethetypeswrong/cli":"^0.18.3","@ljharb/eslint-config":"^22.2.3","@types/object-inspect":"^1.13.0","@types/readable-stream":"^4.0.23","@types/get-package-type":"^0.1.0","array.prototype.flatmap":"^1.3.3","npm-run-posix-or-windows":"^2.0.2","@types/array.prototype.every":"^1.1.1","@types/string.prototype.trim":"^1.2.0","@types/array.prototype.flatmap":"^1.2.6"},"_npmOperationalInternal":{"tmp":"tmp/tape_5.10.1_1781224871171_0.9153292326102906","host":"s3://npm-registry-packages-npm-production"},"readme":"# tape <sup>[![Version Badge][npm-version-svg]][package-url]</sup>\n\n[TAP](https://testanything.org/)-producing test harness for node and browsers\n\n[![github actions][actions-image]][actions-url]\n[![coverage][codecov-image]][codecov-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\n[![npm badge][npm-badge-png]][package-url]\n\n![tape](https://web.archive.org/web/20170612184731if_/http://substack.net/images/tape_drive.png)\n\n# example\n\n``` js\nvar test = require('tape');\n\ntest('timing test', function (t) {\n    t.plan(2);\n\n    t.equal(typeof Date.now, 'function');\n    var start = Date.now();\n\n    setTimeout(function () {\n        t.equal(Date.now() - start, 100);\n    }, 100);\n});\n\ntest('test using promises', async function (t) {\n    const result = await someAsyncThing();\n    t.ok(result);\n});\n```\n\n```\n$ node example/timing.js\nTAP version 13\n# timing test\nok 1 should be strictly equal\nnot ok 2 should be strictly equal\n  ---\n    operator: equal\n    expected: 100\n    actual:   107\n  ...\n\n1..2\n# tests 2\n# pass  1\n# fail  1\n```\n\n# usage\n\nYou always need to `require('tape')` in test files. You can run the tests by usual node means (`require('test-file.js')` or `node test-file.js`).\nYou can also run tests using the `tape` binary to utilize globbing, on Windows for example:\n\n```sh\n$ tape tests/**/*.js\n```\n\n`tape`'s arguments are passed to the [`glob`](https://www.npmjs.com/package/glob) module.\nIf you want `glob` to perform the expansion on a system where the shell performs such expansion, quote the arguments as necessary:\n\n```sh\n$ tape 'tests/**/*.js'\n$ tape \"tests/**/*.js\"\n```\n\nIf you want `tape` to error when no files are found, pass `--strict`:\n\n```sh\n$ tape --strict 'tests/**/*.js'\n```\n\n## Preloading modules\n\nAdditionally, it is possible to make `tape` load one or more modules before running any tests, by using the `-r` or `--require` flag. Here's an example that loads [babel-register](https://babeljs.io/docs/usage/require/) before running any tests, to allow for JIT compilation:\n\n```sh\n$ tape -r babel-register tests/**/*.js\n```\n\nDepending on the module you're loading, you may be able to parameterize it using environment variables or auxiliary files. Babel, for instance, will load options from [`.babelrc`](https://babeljs.io/docs/usage/babelrc/) at runtime.\n\nThe `-r` flag behaves exactly like node's `require`, and uses the same module resolution algorithm. This means that if you need to load local modules, you have to prepend their path with `./` or `../` accordingly.\n\nFor example:\n\n```sh\n$ tape -r ./my/local/module tests/**/*.js\n```\n\nPlease note that all modules loaded using the `-r` flag will run *before* any tests, regardless of when they are specified. For example, `tape -r a b -r c` will actually load `a` and `c` *before* loading `b`, since they are flagged as required modules.\n\n# things that go well with tape\n\n`tape` maintains a fairly minimal core. Additional features are usually added by using another module alongside `tape`.\n\n## pretty reporters\n\nThe default TAP output is good for machines and humans that are robots.\n\nIf you want a more colorful / pretty output there are lots of modules on npm that will output something pretty if you pipe TAP into them:\n\n- [tap-spec](https://github.com/scottcorgan/tap-spec)\n- [tap-dot](https://github.com/scottcorgan/tap-dot)\n- [faucet](https://github.com/tape-testing/faucet)\n- [tap-bail](https://github.com/juliangruber/tap-bail)\n- [tap-browser-color](https://github.com/kirbysayshi/tap-browser-color)\n- [tap-json](https://github.com/gummesson/tap-json)\n- [tap-min](https://github.com/derhuerst/tap-min)\n- [tap-nyan](https://github.com/calvinmetcalf/tap-nyan)\n- [tap-pessimist](https://www.npmjs.org/package/tap-pessimist)\n- [tap-prettify](https://github.com/toolness/tap-prettify)\n- [colortape](https://github.com/shuhei/colortape)\n- [tap-xunit](https://github.com/aghassemi/tap-xunit)\n- [tap-difflet](https://github.com/namuol/tap-difflet)\n- [tape-dom](https://github.com/gritzko/tape-dom)\n- [tap-diff](https://github.com/axross/tap-diff)\n- [tap-notify](https://github.com/axross/tap-notify)\n- [tap-summary](https://github.com/zoubin/tap-summary)\n- [tap-markdown](https://github.com/Hypercubed/tap-markdown)\n- [tap-html](https://github.com/gabrielcsapo/tap-html)\n- [tap-react-browser](https://github.com/mcnuttandrew/tap-react-browser)\n- [tap-junit](https://github.com/dhershman1/tap-junit)\n- [tap-nyc](https://github.com/MegaArman/tap-nyc)\n- [tap-spec (emoji patch)](https://github.com/Sceat/tap-spec-emoji)\n- [tape-repeater](https://github.com/rgruesbeck/tape-repeater)\n- [tabe](https://github.com/Josenzo/tabe)\n\nTo use them, try `node test/index.js | tap-spec` or pipe it into one of the modules of your choice!\n\n## uncaught exceptions\n\nBy default, uncaught exceptions in your tests will not be intercepted, and will cause `tape` to crash. If you find this behavior undesirable, use [`tape-catch`](https://github.com/michaelrhodes/tape-catch) to report any exceptions as TAP errors.\n\n## other\n\n- CoffeeScript support with https://www.npmjs.com/package/coffeetape\n- ES6 support with https://www.npmjs.com/package/babel-tape-runner or https://www.npmjs.com/package/buble-tape-runner\n- Different test syntax with https://github.com/pguth/flip-tape (warning: mutates String.prototype)\n- Electron test runner with https://github.com/tundrax/electron-tap\n- Concurrency support with https://github.com/imsnif/mixed-tape\n- In-process reporting with https://github.com/DavidAnson/tape-player\n- Describe blocks with https://github.com/mattriley/tape-describe\n\n# command-line flags\n\nWhile running tests, top-level configurations can be passed via the command line to specify desired behavior.\n\nAvailable configurations are listed below:\n\n## --require\n\n**Alias**: `-r`\n\nThis is used to load modules before running tests and is explained extensively in the [preloading modules](#preloading-modules) section.\n\n## --ignore\n\n**Alias**: `-i`\n\nThis flag is used when tests from certain folders and/or files are not intended to be run.\nThe argument is a path to a file that contains the patterns to be ignored.\nIt defaults to `.gitignore` when passed with no argument.\n\n```sh\ntape -i .ignore '**/*.js'\n```\n\nAn error is thrown if the specified file passed as argument does not exist.\n\n## --ignore-pattern\n\nSame functionality as `--ignore`, but passing the pattern directly instead of an ignore file.\nIf both `--ignore` and `--ignore-pattern` are given, the `--ignore-pattern` argument is appended to the content of the ignore file.\n\n```sh\ntape --ignore-pattern 'integration_tests/**/*.js' '**/*.js'\n```\n\n## --no-only\nThis is particularly useful in a CI environment where an [only test](#testonlyname-opts-cb) is not supposed to go unnoticed.\n\nBy passing the `--no-only` flag, any existing [only test](#testonlyname-opts-cb) causes tests to fail.\n\n```sh\ntape --no-only **/*.js\n```\n\nAlternatively, the environment variable `NODE_TAPE_NO_ONLY_TEST` can be set to `true` to achieve the same behavior; the command-line flag takes precedence.\n\n# methods\n\nThe assertion methods in `tape` are heavily influenced or copied from the methods in [node-tap](https://github.com/isaacs/node-tap).\n\n```js\nvar test = require('tape')\n```\n\n## test([name], [opts], cb)\n\nCreate a new test with an optional `name` string and optional `opts` object.\n`cb(t)` fires with the new test object `t` once all preceding tests have finished.\nTests execute serially.\n\nAvailable `opts` options are:\n- opts.skip = true/false. See test.skip.\n- opts.timeout = 500. Set a timeout for the test, after which it will fail. See test.timeoutAfter.\n- opts.ignoreSyncTimeout = true/false. Defaults to `true` (unless the `NODE_TAPE_STRICT_TIMEOUT` environment variable is set to a non-empty value). When `false`, a test that blocks the event loop past its timeout is failed once it ends, rather than being allowed to pass. See test.timeoutAfter.\n- opts.objectPrintDepth = 5. Configure max depth of expected / actual object printing. Environmental variable `NODE_TAPE_OBJECT_PRINT_DEPTH` can set the desired default depth for all tests; locally-set values will take precedence.\n- opts.todo = true/false. Test will be allowed to fail.\n\nIf you forget to `t.plan()` out how many assertions you are going to run and you don't call `t.end()` explicitly, or return a Promise that eventually settles, your test will hang.\n\nIf `cb` returns a Promise, it will be implicitly awaited. If that promise rejects, the test will be failed; if it fulfills, the test will end. Explicitly calling `t.end()` while also returning a Promise that fulfills is an error.\n\n## test.skip([name], [opts], cb)\n\nGenerate a new test that will be skipped over.\n\n## test.onFinish(fn)\n\nThe onFinish hook will get invoked when ALL `tape` tests have finished right before `tape` is about to print the test summary.\n\n`fn` is called with no arguments, and its return value is ignored.\n\n## test.onFailure(fn)\n\nThe onFailure hook will get invoked whenever any `tape` tests has failed.\n\n`fn` is called with no arguments, and its return value is ignored.\n\n## t.plan(n)\n\nDeclare that `n` assertions should be run. `t.end()` will be called automatically after the `n`th assertion.\nIf there are any more assertions after the `n`th, or after `t.end()` is called, they will generate errors.\n\n## t.end(err)\n\nDeclare the end of a test explicitly. If `err` is passed in `t.end` will assert that it is falsy.\n\nDo not call `t.end()` if your test callback returns a Promise.\n\n## t.teardown(cb)\n\nRegister a callback to run after the individual test has completed. Multiple registered teardown callbacks will run in order. Useful for undoing side effects, closing network connections, etc.\n\n## t.fail(msg)\n\nGenerate a failing assertion with a message `msg`.\n\n## t.pass(msg)\n\nGenerate a passing assertion with a message `msg`.\n\n## t.timeoutAfter(ms)\n\nAutomatically timeout the test after X ms.\n\nJavaScript is single-threaded, so a test that blocks the event loop (for example, with a long synchronous loop) can not be interrupted mid-run. By default (`ignoreSyncTimeout` is `true`) such a test is allowed to run to completion and pass, even if it runs past the timeout. Setting the `ignoreSyncTimeout` option to `false` - or the `NODE_TAPE_STRICT_TIMEOUT` environment variable (when set to a non-empty value), which flips the default for all tests - instead fails the test once it ends, if it took at least X ms. A per-test `ignoreSyncTimeout` value takes precedence over the environment variable.\n\n## t.skip(msg)\n\nGenerate an assertion that will be skipped over.\n\n## t.ok(value, msg)\n\nAssert that `value` is truthy with an optional description of the assertion `msg`.\n\nAliases: `t.true()`, `t.assert()`\n\n## t.notOk(value, msg)\n\nAssert that `value` is falsy with an optional description of the assertion `msg`.\n\nAliases: `t.false()`, `t.notok()`\n\n## t.error(err, msg)\n\nAssert that `err` is falsy. If `err` is non-falsy, use its `err.message` as the description message.\n\nAliases: `t.ifError()`, `t.ifErr()`, `t.iferror()`\n\n## t.equal(actual, expected, msg)\n\nAssert that `Object.is(actual, expected)` with an optional description of the assertion `msg`.\n\nAliases: `t.equals()`, `t.isEqual()`, `t.strictEqual()`, `t.strictEquals()`, `t.is()`\n\n## t.notEqual(actual, expected, msg)\n\nAssert that `!Object.is(actual, expected)` with an optional description of the assertion `msg`.\n\nAliases: `t.notEquals()`, `t.isNotEqual()`, `t.doesNotEqual()`, `t.isInequal()`, `t.notStrictEqual()`, `t.notStrictEquals()`, `t.isNot()`, `t.not()`\n\n## t.looseEqual(actual, expected, msg)\n\nAssert that `actual == expected` with an optional description of the assertion `msg`.\n\nAliases: `t.looseEquals()`\n\n## t.notLooseEqual(actual, expected, msg)\n\nAssert that `actual != expected` with an optional description of the assertion `msg`.\n\nAliases: `t.notLooseEquals()`\n\n## t.deepEqual(actual, expected, msg)\n\nAssert that `actual` and `expected` have the same structure and nested values using [node's deepEqual() algorithm](https://github.com/inspect-js/node-deep-equal) with strict comparisons (`===`) on leaf nodes and an optional description of the assertion `msg`.\n\nAliases: `t.deepEquals()`, `t.isEquivalent()`, `t.same()`\n\n## t.notDeepEqual(actual, expected, msg)\n\nAssert that `actual` and `expected` do not have the same structure and nested values using [node's deepEqual() algorithm](https://github.com/inspect-js/node-deep-equal) with strict comparisons (`===`) on leaf nodes and an optional description of the assertion `msg`.\n\nAliases: `t.notDeepEquals`, `t.notEquivalent()`, `t.notDeeply()`, `t.notSame()`,\n`t.isNotDeepEqual()`, `t.isNotDeeply()`, `t.isNotEquivalent()`,\n`t.isInequivalent()`\n\n## t.deepLooseEqual(actual, expected, msg)\n\nAssert that `actual` and `expected` have the same structure and nested values using [node's deepEqual() algorithm](https://github.com/inspect-js/node-deep-equal) with loose comparisons (`==`) on leaf nodes and an optional description of the assertion `msg`.\n\n## t.notDeepLooseEqual(actual, expected, msg)\n\nAssert that `actual` and `expected` do not have the same structure and nested values using [node's deepEqual() algorithm](https://github.com/inspect-js/node-deep-equal) with loose comparisons (`==`) on leaf nodes and an optional description of the assertion `msg`.\n\n## t.throws(fn, expected, msg)\n\nAssert that the function call `fn()` throws an exception. `expected`, if present, must be a `RegExp`, `Function`, or `Object`. The `RegExp` matches the string representation of the exception, as generated by `err.toString()`. For example, if you set `expected` to `/user/`, the test will pass only if the string representation of the exception contains the word `user`. Any other exception will result in a failed test. The `Function` could be the constructor for the Error type thrown, or a predicate function to be called with that exception. `Object` in this case corresponds to a so-called validation object, in which each property is tested for strict deep equality. As an example, see the following two tests--each passes a validation object to `t.throws()` as the second parameter. The first test will pass, because all property values in the actual error object are deeply strictly equal to the property values in the validation object.\n```\n    const err = new TypeError(\"Wrong value\");\n    err.code = 404;\n    err.check = true;\n\n    // Passing test.\n    t.throws(\n        () => {\n            throw err;\n        },\n        {\n            code: 404,\n            check: true\n        },\n        \"Test message.\"\n    );\n```\nThis next test will fail, because all property values in the actual error object are _not_ deeply strictly equal to the property values in the validation object.\n```\n    const err = new TypeError(\"Wrong value\");\n    err.code = 404;\n    err.check = \"true\";\n\n    // Failing test.\n    t.throws(\n        () => {\n            throw err;\n        },\n        {\n            code: 404,\n            check: true // This is not deeply strictly equal to err.check.\n        },\n        \"Test message.\"\n    );\n```\n\nThis is very similar to how Node's `assert.throws()` method tests validation objects (please see the [Node _assert.throws()_ documentation](https://nodejs.org/api/assert.html#assert_assert_throws_fn_error_message) for more information).\n\nIf `expected` is not of type `RegExp`, `Function`, or `Object`, or omitted entirely, any exception will result in a passed test. `msg` is an optional description of the assertion.\n\nPlease note that the second parameter, `expected`, cannot be of type `string`. If a value of type `string` is provided for `expected`, then `t.throws(fn, expected, msg)`  will execute, but the value of `expected` will be set to  `undefined`, and the specified string will be set as the value for the `msg` parameter (regardless of what _actually_ passed as the third parameter). This can cause unexpected results, so please be mindful.\n\n## t.doesNotThrow(fn, expected, msg)\n\nAssert that the function call `fn()` does not throw an exception. `expected`, if present, limits what should not be thrown, and must be a `RegExp` or `Function`. The `RegExp` matches the string representation of the exception, as generated by `err.toString()`. For example, if you set `expected` to `/user/`, the test will fail  only if the string representation of the exception contains the word `user`. Any other exception will result in a passed test.  The `Function` is the exception thrown (e.g. `Error`).  If `expected` is not of type `RegExp` or `Function`, or omitted entirely, any exception will result in a failed test. `msg` is an optional description of the assertion.\n\nPlease note that the second parameter, `expected`, cannot be of type `string`. If a value of type `string` is provided for `expected`, then `t.doesNotThrows(fn, expected, msg)`  will execute, but the value of `expected` will be set to  `undefined`, and the specified string will be set as the value for the `msg` parameter (regardless of what _actually_ passed as the third parameter). This can cause unexpected results, so please be mindful.\n\n## t.test(name, [opts], cb)\n\nCreate a subtest with a new test handle `st` from `cb(st)` inside the current test `t`. `cb(st)` will only fire when `t` finishes. Additional tests queued up after `t` will not be run until all subtests finish.\n\nYou may pass the same options that [`test()`](#testname-opts-cb) accepts.\n\n## t.comment(message)\n\nPrint a message without breaking the tap output.\n(Useful when using e.g. `tap-colorize` where output is buffered & `console.log` will print in incorrect order vis-a-vis tap output.)\n\nMultiline output will be split by `\\n` characters, and each one printed as a comment.\n\n## t.match(string, regexp, message)\n\nAssert that `string` matches the RegExp `regexp`. Will fail when the first two arguments are the wrong type.\n\n## t.doesNotMatch(string, regexp, message)\n\nAssert that `string` does not match the RegExp `regexp`. Will fail when the first two arguments are the wrong type.\n\n## t.capture(obj, method, implementation = () => {})\n\nReplaces `obj[method]` with the supplied implementation.\n`obj` must be a non-primitive, `method` must be a valid property key (string or symbol), and `implementation`, if provided, must be a function.\n\nCalling the returned `results()` function will return an array of call result objects.\nThe array of calls will be reset whenever the function is called.\nCall result objects will match one of these forms:\n  - `{ args: [x, y, z], receiver: o, returned: a }`\n  - `{ args: [x, y, z], receiver: o, threw: true }`\n\nThe replacement will automatically be restored on test teardown.\nYou can restore it manually, if desired, by calling `.restore()` on the returned results function.\n\nModeled after [tap](https://tapjs.github.io/tapjs/modules/_tapjs_intercept.html).\n\n## t.captureFn(original)\n\nWraps the supplied function.\nThe returned wrapper has a `.calls` property, which is an array that will be populated with call result objects, described under `t.capture()`.\n\nModeled after [tap](https://tapjs.github.io/tapjs/modules/_tapjs_intercept.html).\n\n## t.intercept(obj, property, desc = {}, strictMode = true)\n\nSimilar to `t.capture()``, but can be used to track get/set operations for any arbitrary property.\nCalling the returned `results()` function will return an array of call result objects.\nThe array of calls will be reset whenever the function is called.\nCall result objects will match one of these forms:\n  - `{ type: 'get', value: '1.2.3', success: true, args: [x, y, z], receiver: o }`\n  - `{ type: 'set', value: '2.4.6', success: false, args: [x, y, z], receiver: o }`\n\nIf `strictMode` is `true`, and `writable` is `false`, and no `get` or `set` is provided, an exception will be thrown when `obj[property]` is assigned to.\nIf `strictMode` is `false` in this scenario, nothing will be set, but the attempt will still be logged.\n\nProviding both `desc.get` and `desc.set` are optional and can still be useful for logging get/set attempts.\n\n`desc` must be a valid property descriptor, meaning that `get`/`set` are mutually exclusive with `writable`/`value`.\nAdditionally, explicitly setting `configurable` to `false` is not permitted, so that the property can be restored.\n\n## t.assertion(fn, ...args)\n\nIf you want to write your own custom assertions, you can invoke these conveniently using this method.\n\n```js\nfunction isAnswer(value, msg) {\n\t// eslint-disable-next-line no-invalid-this\n\tthis.equal(value, 42, msg || 'value must be the answer to life, the universe, and everything');\n};\n\ntest('is this the answer?', (t) => {\n\tt.assertion(isAnswer, 42); // passes, default message\n\tt.assertion(isAnswer, 42, 'what is 6 * 9?'); // passes, custom message\n\tt.assertion(isAnswer, 54, 'what is 6 * 9!'); // fails, custom message\n\n\tt.end();\n});\n```\n\n## var htest = test.createHarness()\n\nCreate a new test harness instance, which is a function like `test()`, but with a new pending stack and test state.\n\nBy default the TAP output goes to `console.log()`. You can pipe the output to someplace else if you `htest.createStream().pipe()` to a destination stream on the first tick.\n\n## test.only([name], [opts], cb)\n\nLike `test([name], [opts], cb)` except if you use `.only` this is the only test case that will run for the entire process, all other test cases using `tape` will be ignored.\n\nCheck out how the usage of [the --no-only flag](#--no-only) could help ensure there is no `.only` test running in a specified environment.\n\n## var stream = test.createStream(opts)\n\nCreate a stream of output, bypassing the default output stream that writes messages to `console.log()`. By default `stream` will be a text stream of TAP output, but you can get an object stream instead by setting `opts.objectMode` to `true`.\n\n### tap stream reporter\n\nYou can create your own custom test reporter using this `createStream()` api:\n\n``` js\nvar test = require('tape');\nvar path = require('path');\n\ntest.createStream().pipe(process.stdout);\n\nprocess.argv.slice(2).forEach(function (file) {\n    require(path.resolve(file));\n});\n```\n\nYou could substitute `process.stdout` for whatever other output stream you want, like a network connection or a file.\n\nPass in test files to run as arguments:\n\n```sh\n$ node tap.js test/x.js test/y.js\nTAP version 13\n# (anonymous)\nnot ok 1 should be strictly equal\n  ---\n    operator: equal\n    expected: \"boop\"\n    actual:   \"beep\"\n  ...\n# (anonymous)\nok 2 should be strictly equal\nok 3 (unnamed assert)\n# wheee\nok 4 (unnamed assert)\n\n1..4\n# tests 4\n# pass  3\n# fail  1\n```\n\n### object stream reporter\n\nHere's how you can render an object stream instead of TAP:\n\n``` js\nvar test = require('tape');\nvar path = require('path');\n\ntest.createStream({ objectMode: true }).on('data', function (row) {\n    console.log(JSON.stringify(row))\n});\n\nprocess.argv.slice(2).forEach(function (file) {\n    require(path.resolve(file));\n});\n```\n\nThe output for this runner is:\n\n```sh\n$ node object.js test/x.js test/y.js\n{\"type\":\"test\",\"name\":\"(anonymous)\",\"id\":0}\n{\"id\":0,\"ok\":false,\"name\":\"should be strictly equal\",\"operator\":\"equal\",\"actual\":\"beep\",\"expected\":\"boop\",\"error\":{},\"test\":0,\"type\":\"assert\"}\n{\"type\":\"end\",\"test\":0}\n{\"type\":\"test\",\"name\":\"(anonymous)\",\"id\":1}\n{\"id\":0,\"ok\":true,\"name\":\"should be strictly equal\",\"operator\":\"equal\",\"actual\":2,\"expected\":2,\"test\":1,\"type\":\"assert\"}\n{\"id\":1,\"ok\":true,\"name\":\"(unnamed assert)\",\"operator\":\"ok\",\"actual\":true,\"expected\":true,\"test\":1,\"type\":\"assert\"}\n{\"type\":\"end\",\"test\":1}\n{\"type\":\"test\",\"name\":\"wheee\",\"id\":2}\n{\"id\":0,\"ok\":true,\"name\":\"(unnamed assert)\",\"operator\":\"ok\",\"actual\":true,\"expected\":true,\"test\":2,\"type\":\"assert\"}\n{\"type\":\"end\",\"test\":2}\n```\n\nA convenient alternative to achieve the same:\n```js\n// report.js\nvar test = require('tape');\n\ntest.createStream({ objectMode: true }).on('data', function (row) {\n    console.log(JSON.stringify(row)) // for example\n});\n```\nand then:\n```sh\n$ tape -r ./report.js **/*.test.js\n```\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```sh\nnpm install tape --save-dev\n```\n\n# troubleshooting\n\nSometimes `t.end()` doesn’t preserve the expected output ordering.\n\nFor instance the following:\n\n```js\nvar test = require('tape');\n\ntest('first', function (t) {\n\n  setTimeout(function () {\n    t.ok(1, 'first test');\n    t.end();\n  }, 200);\n\n  t.test('second', function (t) {\n    t.ok(1, 'second test');\n    t.end();\n  });\n});\n\ntest('third', function (t) {\n  setTimeout(function () {\n    t.ok(1, 'third test');\n    t.end();\n  }, 100);\n});\n```\n\nwill output:\n\n```\nok 1 second test\nok 2 third test\nok 3 first test\n```\n\nbecause `second` and `third` assume `first` has ended before it actually does.\n\nUse `t.plan()` instead to let other tests know they should wait:\n\n```diff\nvar test = require('tape');\n\ntest('first', function (t) {\n\n+  t.plan(2);\n\n  setTimeout(function () {\n    t.ok(1, 'first test');\n-    t.end();\n  }, 200);\n\n  t.test('second', function (t) {\n    t.ok(1, 'second test');\n    t.end();\n  });\n});\n\ntest('third', function (t) {\n  setTimeout(function () {\n    t.ok(1, 'third test');\n    t.end();\n  }, 100);\n});\n```\n\n# license\n\nMIT\n\n[package-url]: https://npmjs.org/package/tape\n[npm-version-svg]: https://versionbadg.es/tape-testing/tape.svg\n[deps-svg]: https://david-dm.org/tape-testing/tape.svg\n[deps-url]: https://david-dm.org/tape-testing/tape\n[dev-deps-svg]: https://david-dm.org/tape-testing/tape/dev-status.svg\n[dev-deps-url]: https://david-dm.org/tape-testing/tape#info=devDependencies\n[npm-badge-png]: https://nodei.co/npm/tape.png?downloads=true&stars=true\n[license-image]: https://img.shields.io/npm/l/tape.svg\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dm/tape.svg\n[downloads-url]: https://npm-stat.com/charts.html?package=tape\n[codecov-image]: https://codecov.io/gh/tape-testing/tape/branch/master/graphs/badge.svg\n[codecov-url]: https://app.codecov.io/gh/tape-testing/tape/\n[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/tape-testing/tape\n[actions-url]: https://github.com/tape-testing/tape/actions\n","publish_time":1781224871260,"_cnpm_publish_time":1781224871260,"dist-tags":{"latest":"5.11.0","next":"5.3.0","v4.x-latest":"4.17.0"}}