{"_id":"@supabase/doctest-js","_rev":"24-a0ca28f6d4ca23bfc59f343e50b73075","name":"@supabase/doctest-js","dist-tags":{"latest":"0.1.0"},"versions":{"0.0.10":{"name":"@supabase/doctest-js","version":"0.0.10","author":{"name":"Supabase"},"license":"MIT","_id":"@supabase/doctest-js@0.0.10","maintainers":[{"name":"ange1ico","email":"angelico.delosreyes@gmail.com"},{"name":"kiwicopple","email":"pcopplestone@gmail.com"}],"dist":{"shasum":"54a69279b09314f49d14a1ae78665e8fb50a4342","tarball":"https://registry.npmjs.org/@supabase/doctest-js/-/doctest-js-0.0.10.tgz","fileCount":21,"integrity":"sha512-9VtqMsF1xlCbDyyIS9CvRjkMXWuMJHP+K05v+2lM2NMEi8yXuoc73YcbnKPNcI5OwHWoAanaZqWmh/dTh8qtMg==","signatures":[{"sig":"MEYCIQDYKljL9uG+Mzi8maIOEQVhLrLUM0aFP2QrpiulYXSsowIhAP08CXDGDDvbFnwT0xvruXagu1k8CjsXuMVwUM4nvLHr","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":295470,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeMRE0CRA9TVsSAnZWagAAPX4P/jkRUjMO11ArqUlgca7E\n/10VIbh97JOGotj5DciUBaBX+cjAY10ARHOH8DfWJNWSWxusOp0gVVhivP/o\ncASrHMynsSeyZvLsxVf7mMNWDYmd+NkuI/4tXpOJ91rzyLo/F2dhlTcynogy\nmbspXiSUu7mVo6k/UJnq1UwXjcCEKICE/RTBOVHNhazBVq6S+xZZ9XZhT5Q+\nNHV9Ky/+lGXIfO2EL/WyVSlxRSLI0NK/6dZcRPTmsMcp0+TTnhAcDMdl6aXZ\nw1zspL4uEvXxhAmUHwEatOILRsJhFfDubz612fVyvfxEzTCQRhhX9sDGZf6H\nnz3DuxG8XeECachucH+PrCcLpzX/+Ru5CX3E0MQZbyBfaZkTgTcTEAmBbAr5\n5nnaJ9bNKKIv7eCQt+dKrp2QoX2dsvU4iL+YNi+MSyKbXvm7zcfl+BC1qZl1\niXY4q5n5H5t1iwzCFnws2tYs44qaXnDwDcsJMgH5ooCjpanVJilbE0Jdq7l9\nDS31NcEN8Ij2V5c+fa9QkVG8mUVUqc/iIBggUhfzQRO7hhjAX/78Cr6dqkYH\n3bF8TbubTKKoUpxRkGhYDDANmbCDeYCAbF7TMghX4mAn9AE505xB/Mvni9eQ\n7x7TdC+SNlD/YNSOW9WLC8SJKMMl9L1sczfl2KcdUqqvRIuoX1wvjnjZJOA4\nktPN\r\n=01ys\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","gitHead":"b8320d698152b6e36c85a49b06945ead9c02ce99","scripts":{"lint":"eslint {src,test}/**/*.js webpack.config.js","test":"mocha --require babel-register","build":"webpack -p","format":"prettier {src,test}/**/*.js  webpack.config.js  --write","precommit":"pretty-quick --staged","test:watch":"npm run test -- --watch"},"_npmUser":{"name":"kiwicopple","email":"pcopplestone@gmail.com"},"_npmVersion":"6.9.0","description":"Run doc examples as tests","directories":{},"_nodeVersion":"10.16.0","dependencies":{"lex":"^1.7.9","chai":"^4.1.2","jison":"^0.4.18","babel-core":"^6.26.3","babel-register":"^6.26.0"},"_hasShrinkwrap":false,"devDependencies":{"husky":"^0.14.3","mocha":"^5.0.4","eslint":"^4.19.0","webpack":"^4.1.1","prettier":"^1.11.1","webpack-cli":"^3.3.0","babel-loader":"^7.1.4","pretty-quick":"^1.4.1","babel-preset-es2015":"^6.24.1","eslint-plugin-react":"^7.7.0","babel-preset-stage-0":"^6.24.1","eslint-config-airbnb":"^16.1.0","eslint-plugin-import":"^2.9.0","eslint-plugin-jsx-a11y":"^6.0.3"},"_npmOperationalInternal":{"tmp":"tmp/doctest-js_0.0.10_1580273971589_0.425919518479718","host":"s3://npm-registry-packages"}},"0.1.0":{"name":"@supabase/doctest-js","version":"0.1.0","author":{"name":"Supabase"},"license":"MIT","_id":"@supabase/doctest-js@0.1.0","maintainers":[{"name":"ange1ico","email":"angelico.delosreyes@gmail.com"},{"name":"awalias","email":"antwilson@hotmail.co.uk"},{"name":"kiwicopple","email":"pcopplestone@gmail.com"}],"homepage":"https://github.com/supabase/doctest-js#readme","bugs":{"url":"https://github.com/supabase/doctest-js/issues"},"dist":{"shasum":"a3e9e3d025d4234e4cd0c952324e6d739d392164","tarball":"https://registry.npmjs.org/@supabase/doctest-js/-/doctest-js-0.1.0.tgz","fileCount":20,"integrity":"sha512-7PR5UhFbqrNVidbzryi7+/U/N8NV+LahuGQApY5kJ5Tuol3EquTkJcO/dN3t/9NDmPjvXq6psfZnT1+I9LW1kQ==","signatures":[{"sig":"MEYCIQCz1j7pBjpUyXN7znzIF1KkKwia0oj57cx6UKQm4lxpTQIhAO6ro/2FmBlnmVQyCORBgAXX4k4UHXImnzz215BAlw1r","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":301829,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUHioCRA9TVsSAnZWagAA92EQAJOWywDy3qvDMAl3BDFF\na5sebdXFUiUZ1njhc1T6k78ay/1/yCTF2e3Ed8lZ563Cqb8O6cG4diwPf1+A\nrMdxC2EyFRfvktuSROeFmlq6a6+tgBYfPvDoylApElloQGlF3OjBrFzoXONw\nPRj50MPNtwGlQX/BtKPieHTbYB3w23COrMXWgc02EYhPdNCMzJZ8YNJcgFhR\nb4HwEVsFGeMZEgbMCXi5UM+uu5zs+SFxfrvxzQyYmGcsJauvaVjZEfvkmbFx\nqzRlaLbLeUHVxJcexJ47HAybiC+FVsAaR9WQ5TMApcIedUjOc+anXZQqghQB\n76GnCMQGMeozaF5CaNddYwioFuGXd6bH+4g/ybEXqvgsVaAy2/IBfrHKy5af\nJRuzgOoJQQTLffY+g2vLE0UpLg4TyRIiJhgft9mSfhG/6LsOORqeZj/375Bt\nUuDmFMb13cy4zEyTX3mQ2ZUwK8h1m0PQjJVI8QeDQY9zdutPe3S6ShxQsica\nilNLEB71PqBNS/X2Pk8QAcDLyWuYm94x4R4axGRppw20pbWpRIGf8dtDRG8V\nbLDXrv9qGYUk/2qe0rxJgkfQixYRX9M5lo3LOhK/KmzzqA9uXkFRudy4nCkC\n5dhyE7mfCMJdYDmuQ6x2jO89E7cVuyZtrisP0Fjf3qA8XwJnBH+lLB6ABLpa\nb8Aq\r\n=7sAh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","gitHead":"e32f3d95d28ea81344b738991bbfa28fd76a9a99","scripts":{"lint":"eslint {src,test}/**/*.js webpack.config.js","test":"mocha --require babel-register","build":"webpack -p","format":"prettier {src,test}/**/*.js  webpack.config.js  --write","pretty":"prettier --write \"**/*.js\"","test:watch":"npm run test -- --watch"},"_npmUser":{"name":"kiwicopple","email":"pcopplestone@gmail.com"},"repository":{"url":"git+https://github.com/supabase/doctest-js.git","type":"git"},"_npmVersion":"6.4.1","description":"Run doc examples as tests","directories":{},"_nodeVersion":"10.15.1","dependencies":{"lex":"^1.7.9","chai":"^4.1.2","jest":"^25.1.0","jison":"^0.4.18","babel-core":"^6.26.3","babel-register":"^6.26.0"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^5.0.4","eslint":"^4.19.0","webpack":"^4.1.1","prettier":"^1.19.1","webpack-cli":"^3.3.0","babel-loader":"^7.1.4","babel-preset-es2015":"^6.24.1","eslint-plugin-react":"^7.7.0","babel-preset-stage-0":"^6.24.1","eslint-config-airbnb":"^16.1.0","eslint-plugin-import":"^2.9.0","eslint-plugin-jsx-a11y":"^6.0.3"},"_npmOperationalInternal":{"tmp":"tmp/doctest-js_0.1.0_1582332071632_0.8975414004396491","host":"s3://npm-registry-packages"}}},"time":{"created":"2020-01-29T04:59:31.372Z","modified":"2026-06-05T14:41:34.543Z","0.0.10":"2020-01-29T04:59:31.708Z","0.1.0":"2020-02-22T00:41:11.821Z"},"bugs":{"url":"https://github.com/supabase/doctest-js/issues"},"author":{"name":"Supabase"},"license":"MIT","homepage":"https://github.com/supabase/doctest-js#readme","repository":{"url":"git+https://github.com/supabase/doctest-js.git","type":"git"},"description":"Run doc examples as tests","maintainers":[],"readme":"# doctest-js\n\nLet your documentation be your testing suite. \n\nWrite [JSDoc](http://usejsdoc.org/about-getting-started.html) style doc examples on all your functions and then test them using `doctest-js`.\n\n**Contents**\n\n- [Getting Started](#getting-started)\n  - [1. Install](#1-install)\n  - [2. Write @example comments](#2-write-example-comments)\n  - [3. Run the tests](#3-run-the-tests)\n- [Advanced](#advanced)\n  - [Multiple tests](#multiple-tests)\n  - [Testing classes](#testing-classes)\n- [FAQ's](#faqs)\n  - [Why isn't my test working?](#why-isnt-my-test-working)\n  - [Do I have to write @param, @returns etc?](#do-i-have-to-write-param-returns-etc)\n  - [I have a long return value. Does it have to go on one line?](#i-have-a-long-return-value-does-it-have-to-go-on-one-line)\n- [Usage online](#usage-online)\n- [Contributing](#contributing)\n- [Credits](#credits)\n\n## Getting Started\n\n### 1. Install\n\n```sh\nnpm install @supabase/doctest-js\n```\n\n### 2. Write @example comments\n\nCreate a [JSDoc style @example](https://jsdoc.app/tags-example.html) on any functions that you want tested. \n\n```javascript\n/**\n * Returns the sum of 2 numbers\n *\n * @example sum(1, 2)\n * //=> 3\n */\nexport const sum = (a, b) => {\n  return a + b\n}\n```\n\nNote that the expected return value must be prefixed by `//=>`.\n\n### 3. Run the tests\n\nImport the doctest function in your test suite and point it at the file.\n\n```javascript\nimport doctests from '@supabase/doctest-js';\n\ndescribe('Doctests', () => {\n  // file paths are relative to root of directory\n  doctest('src/sum.js');\n  doctest('src/someOtherFile.js');\n});\n```\n\n## Advanced\n\n### Multiple tests\n\nYou can run multiple tests for the same function.\n\n```javascript\n/**\n * @example sum(1, 2)\n * //=> 3\n * @example sum(3, 4)\n * //=> 7\n */\nexport const sum = (a, b) => {\n  return a + b\n}\n```\n\n### Testing classes\n\nTesting classes requires you to pass a newed up instance of the class into the test itself. Here is a simple example:\n\n```js\n// Arithmetic.js - a basic class which we need to test\n\nclass Arithmetic {\n  constructor() {}\n\n  /**\n   * @example\n   * add(1, 2)\n   * //=> 3\n   */\n  add(a, b) {\n    return a + b\n  }\n}\n\nexport { Arithmetic }\n```\n\n```js\n// Arithmetic.test.js\n\nconst { Arithmetic } = require('./Arithmetic.js');\n\ndescribe('passing doctest', () => {\n  doctest('./Arithmetic.js', { instance: new Arithmetic() });\n});\n```\n\n\n## FAQ's\n\n### Why isn't my test working?\n\nHere are some tips:\n\n<table style=\"width: 100%;\">\n<tr>\n  <td colspan=\"2\" style=\"text-align: center;\">\n  1. Try putting the @example declaration and function on the same line\n  </td>\n</tr>\n<tr>\n  <th style=\"width: 50%;\">Do</th>\n  <th style=\"width: 50%;\">Avoid</th>\n</th>\n</tr>\n<tr>\n  <td>\n  <pre>\n  /**\n  * @example add(1, 2)\n  */</pre>\n  </td>\n  <td>\n  <pre>\n  /**\n  * @example\n  * add(1, 2)\n  */</pre>\n  </td>\n</tr>\n<tr>\n  <td colspan=\"2\" style=\"text-align: center;\">\n  2.Try putting the return value on one line\n  </td>\n</tr>\n<tr>\n  <th style=\"width: 50%;\">Do</th>\n  <th style=\"width: 50%;\">Avoid</th>\n</th>\n</tr>\n<tr>\n  <td>\n  <pre>\n  /**\n  * @example add(1, 2)\n  * //=> 3 \n  */</pre>\n  </td>\n  <td>\n  <pre>\n  /**\n  * @example add(1, 2)\n  * //=> \n  * 3 \n  */</pre>\n  </td>\n</tr>\n<tr>\n  <td colspan=\"2\" style=\"text-align: center;\">\n  3.Try removing spaces between multiple tests\n  </td>\n</tr>\n<tr>\n  <th style=\"width: 50%;\">Do</th>\n  <th style=\"width: 50%;\">Avoid</th>\n</th>\n</tr>\n<tr>\n  <td>\n  <pre>\n  /**\n  * @example add(1, 2)\n  * //=> 3 \n  * @example add(5, 5)\n  * //=> 3 \n  */</pre>\n  </td>\n  <td>\n  <pre>\n  /**\n  * @example add(1, 2)\n  * //=> 3 \n  * \n  * @example add(5, 5)\n  * //=> 3 \n  */</pre>\n  </td>\n</tr>\n</table>\n\n\n### Do I have to write @param, @returns etc?\n\nThe only JSDoc component you need is the `@example`.\n\n### I have a long return value. Does it have to go on one line?\n\nNo. Example function calls and return values can span multiple lines but as mentioned above, it may cause problems (with the parser ... PR's welcome!).\n\n\n## Usage online \n\nSee this in the wild:\n\n- [supabase/postgrest-js](https://github.com/supabase/postgrest-js/blob/master/test/unit/Doctests.test.js)\n\n## Contributing\n\n- Fork the repo on GitHub\n- Clone the project to your own machine\n- Commit changes to your own branch\n- Push your work back up to your fork\n- Submit a Pull request so that we can review your changes and merge\n\n## Credits\n\n* Inspired by [Elixir Doctests](https://elixir-lang.org/getting-started/mix-otp/docs-tests-and-with.html)\n* Original fork of [mainshayne223/doctest-js](https://github.com/MainShayne233/js-doctest). See [issue #1](https://github.com/MainShayne233/js-doctest/issues/1).\n","readmeFilename":"README.md"}