{"id":22452640,"url":"https://github.com/totaltechgeek/pineapple","last_synced_at":"2026-03-12T17:04:52.161Z","repository":{"id":39897358,"uuid":"484504887","full_name":"TotalTechGeek/pineapple","owner":"TotalTechGeek","description":"Make your test development sweet!","archived":false,"fork":false,"pushed_at":"2023-06-09T18:20:46.000Z","size":3622,"stargazers_count":15,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-20T03:39:46.447Z","etag":null,"topics":["javascript","test","testing","typescript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TotalTechGeek.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-22T16:41:52.000Z","updated_at":"2024-05-17T05:14:33.000Z","dependencies_parsed_at":"2024-06-20T00:06:30.421Z","dependency_job_id":"9058bc79-3894-40e3-8ecb-81d7b128b986","html_url":"https://github.com/TotalTechGeek/pineapple","commit_stats":{"total_commits":205,"total_committers":3,"mean_commits":68.33333333333333,"dds":"0.18536585365853664","last_synced_commit":"f99b965f22e2d2d3d0bbd9943d4d27cd59bdfcd5"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/TotalTechGeek/pineapple","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TotalTechGeek%2Fpineapple","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TotalTechGeek%2Fpineapple/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TotalTechGeek%2Fpineapple/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TotalTechGeek%2Fpineapple/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TotalTechGeek","download_url":"https://codeload.github.com/TotalTechGeek/pineapple/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TotalTechGeek%2Fpineapple/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30434110,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T14:34:45.044Z","status":"ssl_error","status_checked_at":"2026-03-12T14:09:33.793Z","response_time":114,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","test","testing","typescript"],"created_at":"2024-12-06T06:11:56.789Z","updated_at":"2026-03-12T17:04:52.145Z","avatar_url":"https://github.com/TotalTechGeek.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cp align=\"center\"\u003e\n\u003cimg width=400 alt=\"A picture of a pineapple with a galaxy behind it with the word 'pineapple' under it.\" src=\"https://raw.githubusercontent.com/TotalTechGeek/pineapple/master/resources/pineapple.png\" /\u003e\u003cbr/\u003e \u003cp align=\"center\" style=\"font-size: 18px;\"\u003eMaking your software tests sweet! \u003c/p\u003e\n\n\u003c/p\u003e\n\n---\n\n## What is this?\n\n[![npm version](https://badge.fury.io/js/pineapple.svg)](https://badge.fury.io/js/pineapple) [![Node.js CI](https://github.com/TotalTechGeek/pineapple/actions/workflows/node.js.yml/badge.svg)](https://github.com/TotalTechGeek/pineapple/actions/workflows/node.js.yml) [![Coverage Status](https://coveralls.io/repos/github/TotalTechGeek/pineapple/badge.svg)](https://coveralls.io/github/TotalTechGeek/pineapple)\n\nPineapple is a test framework designed to remove the cruft from writing unit tests and creating snapshots.\n\n```js\n/**\n * Adds numbers together for the sake of demonstrating pineapple.\n * @test 1, 2 returns 3\n * @test '1', 2 throws \"Not a number\"\n * @param {number} a \n * @param {number} b\n */\nexport function add(a, b) {\n    if (typeof a !== 'number' || typeof b !== 'number') throw new Error('Not a number')\n    return a + b\n}\n```\n\nPineapple allows you to embed a few example test-cases in your JSDocs, making it easier to focus on your code and less on defining `it` \u0026 `expect` chains.\n\n\u003cimg alt=\"An example of the snapshot functionality where the code is modified and the snapshot fails due to a renamed attribute\" src=\"https://jessemitchell.me/pineapple/img/snapshot.gif\" width=60% /\u003e\n\n## Documentation\n\nVisit our [documentation here](https://pineapple.js.org).\n\n## Highlights\n\n### Snapshots\n\nWhen you omit conditions from your test cases, Pineapple will automatically capture the result of your test \u0026 snapshot it, making it easier to preserve expected behavior in your applications, and even easier for users to find examples on how to call your code.\n\n### Property Based / Fuzz Testing\n\nBy leveraging fast-check, Pineapple makes it simple to fuzz-test your functions with simple clauses.\n\nThis pairs extremely well with the snapshot testing for capturing a variety of test-cases that would've taken time to generate by hand.\n\n```typescript\n/**\n * Computes the sum of numbers.\n * @test #array(#integer)\n */\nexport function sum(arr: number[]) {\n    return arr.reduce((a,b) =\u003e a + b, 0)\n}\n```\n\n### Language-Idiomatic Test Code\n\nEven in cases where you might need to write a more complex unit test, Pineapple encourages you to write normal JavaScript functions.\n\n### Continuous Test Runner\n\nBy enabling the `-w` or `--watch-mode` flag, Pineapple will watch your project for changes. Any changes to a file will kick off all tests that could be potentially impacted by your change.\n\n**And Much More**\n\n## To Install\n\n```\nnpm i pineapple --save-dev\n```\n\nor\n\n```\nyarn add pineapple --dev\n```\n\nAlternatively, you may install the runner globally (add a `-g` flag).\n\n### To Run\n\n```\nUsage: pineapple [options]\n\nOptions:\n  -V, --version                  output the version number\n  -i, --include \u003cfiles...\u003e       Comma separated globs of files to include.\n  -e, --exclude \u003cfiles...\u003e       Comma separated globs of files to exclude.\n  -w, --watch-mode               Will run tests only when a file is modified.\n  -a, --accept-all               Accept all snapshots.\n  -u, --update-all               Update all snapshots.\n  -t, --transpile                Enables transpilation.\n  --typescript                   Enables transpilation for TypeScript. (legacy flag)\n  --timeout \u003cmilliseconds\u003e       The timeout for each test. (default: \"5000\")\n  --strict                       Enables additional checks to enforce better testing, namely validating that all snapshots are used.\n  --clean                        Cleans up unused snapshots.\n  --omit-snapshot-inputs         Omits input from being captured in snapshots for fuzz testing.\n  --only \u003clines...\u003e              Allows you to specify which tests you would like to run.\n  --fuzz-runs \u003camount\u003e           The number of runs that fuzz tests perform. (default: \"100\")\n  --snapshot-fuzz-runs \u003camount\u003e  The number of runs that fuzz tests perform on a snapshot. (default: \"10\")\n  -f, --format \u003cformat\u003e          The output format (choices: \"json\", \"console\", default: \"console\")\n  --bun                          Uses Bun as the test runner.\n  -h, --help                     display help for command\n```\n\n#### Example\n\n```\npineapple -i src/**/*.js\n```\n\n#### Continuous Integration\n\nIf `process.env.CI` / the environment variable `CI` is set, it will automatically fail if a snapshot is not set or if the snapshot does not match.\n\n## Q\u0026A\n\n#### Does Pineapple support TypeScript?\n\nYes! Out of the box, Pineapple supports JavaScript, TypeScript, JSX \u0026 TSX.\n\nIt also supports both CommonJS and ES Modules, and a few other common module mechanisms.\n\nBy using `-t` or `--transpile`, you can enable the bundling functionality.\n\n#### Does Pineapple support alternative builds / Babel?\n\nYes. If you're using a Flow or another JavaScript framework that might need some additional transpilation, Pineapple will allow you to register a custom transpiler with the `@pineapple_transpile` annotation.\n\n#### Should I put pineapple on my pizza?\n\nThe author of this project holds no opinion on this subject, but you might want to consider that Pineapple doesn't necessarily go well with every use case, so for certain types of tests we actively encourage you to choose a framework better suited for that style of test.\n\nPineapple is oriented towards simplifying unit tests \u0026 making it easy to run multiple test cases against functions, but if you're trying to test a series of complex processes against something stateful (transactions against a rewards points system, combat, etc), scenario tests are likely your better bet.\n\nBecause of this, Pineapple does include a [scenario testing framework](https://pineapple.js.org/docs/scenario-testing/introduction) similar to [Cucumber.js](https://cucumber.io/docs/cucumber/api/?lang=javascript), but if you're trying to implement end-to-end UI tests or integration tests, Newman or Playwright or Cypress might fit the bill better.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftotaltechgeek%2Fpineapple","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftotaltechgeek%2Fpineapple","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftotaltechgeek%2Fpineapple/lists"}