{"_id":"supertape@13.6.2","bin":{"tape":"bin/tracer.js","supertape":"bin/tracer.js"},"bugs":{"url":"https://github.com/coderaiser/supertape/issues"},"dist":{"shasum":"43c672b6aa0f05649e1c6649830d4e4c63254a7a","tarball":"http://registry-npm.ywwl.com/supertape/download/supertape-13.6.2.tgz","fileCount":37,"integrity":"sha512-VPNYybfbgrTMhhOl4amTfEQ1NpyOPH+gq29rlHeBFyKmKMAcUa1ZEaUWbexY4YLUAzNvaFKOGVzogvZFKq4T9A==","signatures":[{"sig":"MEQCIDrDDjoeVu01LDCJao9O+MpyIuCzHeJrqsPE7RLN2L9aAiBWQ5Q2aff00OlvMi1MfWFMh+4M0GMoiiJK01lkEebcxw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAiIXD3F4RmzJP+Gb5xord1KqfI2yftu9gF6vLNRmPfaAiB54hbqXIFJNmULxuqAJrp+khl8PQZKENtJK5wSvsnTMQ=="}],"unpackedSize":98744,"size":26078,"noattachment":false,"key":"/supertape/-/supertape-13.6.2.tgz"},"main":"./lib/supertape.js","name":"supertape","type":"module","types":"./lib/supertape.d.ts","author":{"url":"https://github.com/coderaiser","name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"engines":{"node":">=22"},"exports":{".":"./lib/supertape.js","./cli":"./lib/cli.js","./env":"./lib/env/index.js","./exit-codes":"./lib/exit-codes.js","./bin/supertape":"./bin/tracer.js"},"gitHead":"76b22599060144b83e2f295551c24ad0467415f4","imports":{"#is-fail-tests":"./lib/call-when-tests-ends/is-fail-tests.js","#is-only-tests":"./lib/call-when-tests-ends/is-only-tests.js","#is-skip-tests":"./lib/call-when-tests-ends/is-skip-tests.js","#call-when-tests-ends":"./lib/call-when-tests-ends/index.js"},"license":"MIT","scripts":{"lint":"madrun lint","test":"madrun test","report":"madrun report","wisdom":"madrun wisdom","coverage":"madrun coverage","fix:lint":"madrun fix:lint","test:dts":"madrun test:dts","fresh:lint":"madrun fresh:lint","lint:fresh":"madrun lint:fresh","watch:test":"madrun watch:test"},"version":"13.6.2","_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"homepage":"http://github.com/coderaiser/supertape","keywords":["function","promise","async","await","then","tap","tape","testing"],"repository":{"url":"git+https://github.com/coderaiser/supertape.git","type":"git"},"_npmVersion":"12.0.2","description":"📼 Supertape simplest high speed test runner with superpowers","directories":{},"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_nodeVersion":"26.10.0","dependencies":{"glob":"^13.0.0","once":"^1.4.0","flatted":"^3.3.1","resolve":"^1.17.0","wraptile":"^3.0.0","fullstore":"^4.0.0","jest-diff":"^30.0.3","stacktracey":"^2.1.7","cli-progress":"^3.8.2","try-to-catch":"^4.0.0","yargs-parser":"^22.0.0","@cloudcmd/stub":"^5.0.0","just-snake-case":"^3.2.0","json-with-bigint":"^3.4.4","@putout/cli-keypress":"^4.0.0","@supertape/engine-loader":"^4.0.0","@supertape/formatter-tap":"^4.0.0","@supertape/operator-stub":"^4.0.0","@putout/cli-validate-args":"^2.0.0","@supertape/formatter-fail":"^5.0.0","@supertape/formatter-time":"^3.0.0","@supertape/formatter-short":"^3.0.0","@supertape/formatter-json-lines":"^3.0.0","@supertape/formatter-progress-bar":"^8.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^10.0.2","madrun":"^13.0.0","montag":"^2.0.1","putout":"^42.0.17","currify":"^4.0.0","find-up":"^8.0.0","nodemon":"^3.0.1","pullout":"^5.0.1","runsome":"^2.0.1","superc8":"^12.0.0","check-dts":"^1.0.0","try-catch":"^4.0.2","typescript":"^6.0.2","@iocmd/wait":"^2.1.0","@putout/eslint-flat":"^4.0.0","eslint-plugin-putout":"^31.0.1"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/supertape_13.6.2_1790507718400_0.45703174245363387"},"readme":"# 📼 Supertape [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL] [![License: MIT][MITLicenseIMGURL]][MITLicenseURL]\n\n[NPMURL]: https://npmjs.org/package/supertape \"npm\"\n[NPMIMGURL]: https://img.shields.io/npm/v/supertape.svg?style=flat&longCache=true\n[BuildStatusURL]: https://github.com/coderaiser/supertape/actions?query=workflow%3A%22Node+CI%22 \"Build Status\"\n[BuildStatusIMGURL]: https://github.com/coderaiser/supertape/workflows/Node%20CI/badge.svg\n[BuildStatusURL]: https://travis-ci.org/coderaiser/supertape \"Build Status\"\n[CoverageURL]: https://coveralls.io/github/coderaiser/supertape?branch=master\n[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/supertape/badge.svg?branch=master&service=github\n[MITLicenseURL]: https://opensource.org/licenses/MIT\n[MITLicenseIMGURL]: https://img.shields.io/badge/License-MIT-green.svg\n[DeepScanURL]: https://deepscan.io/dashboard#view=project&tid=16903&pid=20212&bid=545568\n[DeepScanIMGURL]: https://deepscan.io/api/teams/16903/projects/20212/branches/545568/badge/grade.svg\n\n[![supertape](https://asciinema.org/a/Cgc3rDOfZAeDnJSxzEYpPfBMY.svg)](https://asciinema.org/a/Cgc3rDOfZAeDnJSxzEYpPfBMY)\n\n[**Tape**](https://github.com/substack/tape)-inspired [`TAP`](https://testanything.org/)-compatible simplest high speed test runner with superpowers.\n\n📼 **Supertape** is a fast, minimal test runner with the soul of **tape**. It's designed to be as compatible as possible with **tape** while still having some key improvements, such as:\n\n- the ability to work with [ESM Modules](https://nodejs.org/api/esm.html) (take a look at [mock-import](https://github.com/coderaiser/mock-import) for mocking and 🎩[ESCover](https://github.com/coderaiser/escover) for coverage)\n- a number of [built-in pretty output formatters](#formatters)\n- the ability to [extend](#testextendextensions)\n- showing colored diff when using the [`t.equal()`](#tequalresult-any-expected-any-message-string) and [`t.deepEqual()`](#tdeepequalresult-any-expected-any-message-string) assertion operators\n- detailed stack traces for `async` functions\n- multiple [`test.only`'s](#testonlyname-cb)\n- [smart timeouts](#environment-variables) for long running tests 🏃‍♂️\n- more natural assertions: `expected, result` -> `result, expected`:```js\n  t.equal(error.message, 'hello world', `expected error.message to be 'hello world'`);\n\n````\n- ability to test files that imports css with:\n\n```sh\nNODE_OPTIONS=\"--import @supertape/loader-css\" tape '{bin,lib}/**/*.spec.*'\n````\n\nOr in 🏎️[`madrun`](https://github.com/coderaiser/madrun):\n\n```js\nt.equal(error.message, 'hello world', `expected error.message to be 'hello world'`);\n```\n\nor jsx:\n\n```js\nimport {run, defineEnv} from 'supertape/env';\n\nconst testEnv = defineEnv({\n    timeout: 7000,\n    css: true,\n});\n\nexport default {\n    test: () => [testEnv, `tape 'lib/**/*.spec.js'`],\n    coverage: async () => [testEnv, `c8 ${await run('test')}`],\n};\n```\n\nor dom:\n\n```js\nimport {run, defineEnv} from 'supertape/env';\n\nconst testEnv = defineEnv({\n    timeout: 7000,\n    jsx: true,\n});\n\nexport default {\n    test: () => [testEnv, `tape 'lib/**/*.spec.js'`],\n    coverage: async () => [testEnv, `c8 ${await run('test')}`],\n};\n```\n\n📼 **Supertape** doesn't contain:\n\n- assertion aliases, making the available operators far more concise\n- `es3 code` and lot's of [ponyfills](https://github.com/sindresorhus/ponyfill#how-are-ponyfills-better-than-polyfills);\n- `t.throws()`, `t.doesNotThrow()` - use [**tryCatch**](https://github.com/coderaiser/try-catch) or [**tryToCatch**](https://github.com/coderaiser/try-to-catch) with [`t.equal()`](#tequalresult-any-expected-any-message-string) instead;\n- [`t.plan()`](https://github.com/substack/tape#tplann);\n\nFor a list of all built-in assertions, see [Operators](#operators).\n\n## How 📼**Supertape** test looks like?\n\nYou can use both **CommonJS** and **ESM**, here is **ESM** example:\n\n```js\nimport {run, defineEnv} from 'supertape/env';\n\nconst testEnv = defineEnv({\n    timeout: 7000,\n    jsx: true,\n    dom: true,\n});\n\nexport default {\n    test: () => [testEnv, `tape 'lib/**/*.spec.js'`],\n    coverage: async () => [testEnv, `c8 ${await run('test')}`],\n};\n```\n\n## Install\n\n```\nnpm i supertape -D\n```\n\n## Usage\n\n```\nUsage: supertape [options] [path]\nOptions\n   -h, --help                  display this help and exit\n   -v, --version               output version information and exit\n   -f, --format                use a specific output format - default: progress-bar/tap on CI\n   -r, --require               require module\n   --no-check-scopes           do not check that messages contains scope: 'scope: message'\n   --no-check-assertions-count do not check that assertion count is no more then 1\n   --no-check-duplicates       do not check messages for duplicates\n   --no-worker                 disable worker thread\n```\n\n## Environment variables\n\n- `SUPERTAPE_TIMEOUT` - timeout for long running processes, defaults to `3000` (3 seconds);\n- `SUPERTAPE_CHECK_DUPLICATES` - toggle check duplicates;\n- `SUPERTAPE_CHECK_SCOPES` - check that test message has a scope: `scope: subject`;\n- `SUPERTAPE_CHECK_ASSERTIONS_COUNT` - check that assertion count is no more then 1;\n- `SUPERTAPE_CHECK_SKIPPED` - check that skipped count equal to `0`, exit with status code;\n- `SUPERTAPE_LOAD_LOOP_TIMEOUT` - timeout for load tests, defaults to `5ms`, when mocha used as runner - `50ms` optimal;\n\n```js\nimport {test} from 'supertape';\n\nconst sump = (a, b) => a + b;\n\ntest('calc: sum', (t) => {\n    const result = sum(1, 2);\n    const expected = 3;\n    \n    t.equal(result, expected);\n    t.end();\n});\n```\n\n## 🤷 How to migrate from `tape`?\n\nYou can convert your codebase from `tape` to 📼`Supertape` with help of 🐊[`Putout`](https://github.com/coderaiser/putout), which has built-in [@putout/plugin-tape](https://github.com/coderaiser/putout/tree/master/packages/plugin-tape),\nwhich has a lot of rules that helps to write tests.\nHere is [result example](https://github.com/coderaiser/cloudcmd/commit/74d56f795d22e98937dce0641ee3c7514a79e9e6).\n\n## `ESLint` rules\n\n[`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#readme) has rules for 📼`Supertape`:\n\n- ✅ [`remove-newline-before-t-end`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout/lib/tape-remove-newline-before-t-end#readme)\n- ✅ [`add-newline-before-assertion`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout/lib/tape-add-newline-before-assertion#readme)\n- ✅ [`add-newline-between-tests`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout/lib/tape-add-newline-between-tests#readme)\n\n## Operators\n\nThe assertion methods of 📼 **Supertape** are heavily influenced by [**tape**](https://github.com/substack/tape). However, to keep a minimal core of assertions, there are no aliases and some superfluous operators have been removed (such as `t.throws()`).\n\nThe following is a list of the base methods maintained by 📼 **Supertape**. Others, such as assertions for stubbing, are maintained in [special operators](#special-operators). To add custom assertion operators, see [Extending](#testextendextensions).\n\n### Core Operators\n\n#### `t.equal(result: any, expected: any, message?: string)`\n\nAsserts that `result` and `expected` are strictly equal. If `message` is provided, it will be outputted as a description of the assertion.\n\n*Note: uses `Object.is(result, expected)`*\n\n#### `t.notEqual(result: any, expected: any, message?: string)`\n\nAsserts that `result` and `expected` are not strictly equal. If `message` is provided, it will be outputted as a description of the assertion.\n\n*Note: uses `!Object.is(result, expected)`*\n\n#### `t.deepEqual(result: any, expected: any, message?: string)`\n\nAsserts that `result` and `expected` are loosely equal, with the same structure and nested values. If `message` is provided, it will be outputted as a description of the assertion.\n\n*Note: uses [node's deepEqual() algorithm][NodeDeepEqual] with strict comparisons (`===`) on leaf nodes*\n\n#### `t.notDeepEqual(result: any, expected: any, message?: string)`\n\nAsserts that `result` and `expected` not loosely equal, with different structure and/or nested values. If `message` is provided, it will be outputted as a description of the assertion.\n\n*Note: uses [node's deepEqual() algorithm][NodeDeepEqual] with strict comparisons (`===`) on leaf nodes*\n\n[NodeDeepEqual]: https://github.com/substack/node-deep-equal\n\n#### `t.ok(result: boolean | any, message?: string)`\n\nAsserts that `result` is truthy. If `message` is provided, it will be outputted as a description of the assertion.\n\n#### `t.notOk(result: boolean | any, message?: string)`\n\nAsserts that `result` is falsy. If `message` is provided, it will be outputted as a description of the assertion.\n\n#### `t.pass(message: string)`\n\nGenerates a passing assertion with `message` as a description.\n\n#### `t.fail(message: string)`\n\nGenerates a failing assertion with `message` as a description.\n\n#### `t.end()`\n\nDeclares the end of a test explicitly. Must be called exactly once per test. (See: [Single Call to `t.end()`](#single-tend))\n\n#### `t.match(result: string, pattern: string | RegExp, message?: string)`\n\nAsserts that `result` matches the regex `pattern`. If `pattern` is not a valid regex, the assertion fails. If `message` is provided, it will be outputted as a description of the assertion.\n\n#### `t.notMatch(result: string, pattern: string | RegExp, message?: string)`\n\nAsserts that `result` does not match the regex `pattern`. If `pattern` is not a valid regex, the assertion always fails. If `message` is provided, it will be outputted as a description of the assertion.\n\n#### `t.comment(message: string)`\n\nPrint a message without breaking the `TAP` output. Useful when using a `tap`-reporter such as `tap-colorize`, where the output is buffered and `console.log()` will print in incorrect order vis-a-vis `TAP` output.\n\n### Special Operators\n\nTo simplify the core of 📼 **Supertape**, other operators are maintained in separate packages. The following is a list of all such packages:\n\nHere is a list of built-int operators:\n\n| Package | Version |\n|---------|---------|\n| [`@supertape/operator-stub`](/packages/operator-stub) | [![npm](https://img.shields.io/npm/v/@supertape/operator-stub.svg?maxAge=86400)](https://www.npmjs.com/package/@supertape/operator-stub) |\n\n## Formatters\n\nThere is a list of built-int `formatters` to customize output:\n\n| Package | Version |\n|---------|---------|\n| [`@supertape/formatter-tap`](/packages/formatter-tap) | [![npm](https://img.shields.io/npm/v/@supertape/formatter-tap.svg?maxAge=86400)](https://www.npmjs.com/package/@supertape/formatter-tap) |\n| [`@supertape/formatter-fail`](/packages/formatter-fail) | [![npm](https://img.shields.io/npm/v/@supertape/formatter-fail.svg?maxAge=86400)](https://www.npmjs.com/package/@supertape/formatter-fail) |\n| [`@supertape/formatter-short`](/packages/formatter-short) | [![npm](https://img.shields.io/npm/v/@supertape/formatter-short.svg?maxAge=86400)](https://www.npmjs.com/package/@supertape/formatter-short) |\n| [`@supertape/formatter-progress-bar`](/packages/formatter-progress-bar) | [![npm](https://img.shields.io/npm/v/@supertape/formatter-progress-bar.svg?maxAge=86400)](https://www.npmjs.com/package/@supertape/formatter-progress-bar) |\n| [`@supertape/formatter-json-lines`](/packages/formatter-json-lines) | [![npm](https://img.shields.io/npm/v/@supertape/formatter-json-lines.svg?maxAge=86400)](https://www.npmjs.com/package/@supertape/formatter-json-lines) |\n\n## API\n\n### test(message: string, fn: (t: Test) => void, options?: TestOptions)\n\nCreate a new test with `message` string.`fn(t)` fires with the new test object `t` once all preceding tests have\nfinished. Tests execute serially.\n\nHere is Possible `options` similar to [Environment Variables](#environment-variables) but relates to one test:\n\n- `checkDuplicates`;\n- `checkScopes`;-\n- `checkAssertionsCount`;\n- `timeout`;\n\n```js\ntest('tape: error', (t) => {\n    t.equal(error.code, 'ENOENT');\n    t.end();\n});\n```\n\n### test.only(message, fn, options?)\n\nLike `test(name, cb)` except if you use `.only` this is the only test case\nthat will run for the entire process, all other test cases using `tape` will\nbe ignored.\n\n### test.skip(message, fn, options?)\n\nGenerate a new test that will be skipped over.\n\n### test.extend(extensions)\n\nExtend base assertions with more:\n\n```js\ntest('hello: world', (t) => {\n    t.equal('hello', 'world');\n    t.end();\n});\n```\n\n### `isOnlyTests`\n\nWhen you need to know if there was `only` tests use:\n\n```js\nimport {extend} from 'supertape';\n\nconst test = extend({\n    transform: (operator) => (a, b, message = 'should transform') => {\n        const {is, output} = operator.equal(a + 1, b - 1);\n        \n        return {\n            is,\n            output,\n        };\n    },\n});\n\ntest('assertion', (t) => {\n    t.transform(1, 3);\n    t.end();\n});\n```\n\n### `isSkipTests`\n\nWhen you need to know if there was `skip` tests use:\n\n```js\nimport {isOnlyTests} from 'supertape';\n\nisOnlyTests();\n```\n\n### `isFailTests`\n\nWhen you need to know if there was `failed` tests use:\n\n```js\nimport {isSkipTests} from 'supertape';\n\nisSkipTests();\n```\n\n### `callWhenTestsEnds`\n\nCall your function when tests ends (usually on 'process.exit')\n\n```js\nimport {isFailTests} from 'supertape';\n\nisFailTests();\n```\n\n## Example\n\n```js\nimport {callWhenTestsEnds} from 'supertape';\n\ncallWhenTestsEnds('TYPE_CHECK', () => {\n    console.log(`tests ends without 'skip' and 'only'`);\n});\n```\n\n## 🚪Exit Codes\n\n📼**Supertape** can have one of next [exit codes](https://github.com/coderaiser/supertape/blob/master/packages/supertape/lib/exit-codes.js):\n\n| Code | Name             | Description                                                                          |\n|------|------------------|--------------------------------------------------------------------------------------|\n| 0    | `OK`             | no errors found                                                                      |\n| 1    | `FAIL`           | test failed                                                                          |\n| 2    | `WAS_STOP`       | test was halted by user                                                              |\n| 3    | `UNHANDLED`      | unhandled exception occurred                                                         |\n| 4    | `INVALID_OPTION` | wrong option provided                                                                |\n| 5    | `SKIPPED`        | works only with `SUPERTAPE_CHECK_SKIPPED` env variable when skipped files 1 and more |\n\nHere is how exit code can look like:\n\n```js\nimport {test} from 'supertape';\n\ntest('lib: arguments', async (t) => {\n    throw Error('hello');\n    // will call t.fail with an error\n    // will call t.end\n});\n\ntest('lib: diff', (t) => {\n    t.equal({}, {hello: 'world'}, 'should equal');\n    t.end();\n});\n// output\n`\n- Expected\n+ Received\n\n- Object {}\n+ Object {\n+   \"hello\": \"world\",\n+ }\n`;\n```\n\n## License\n\nMIT\n","publish_time":1790507718483,"_cnpm_publish_time":1790507718483,"dist-tags":{"latest":"13.6.2"}}