{"id":15598373,"url":"https://github.com/fluffynuts/node-tempdb","last_synced_at":"2025-07-24T18:11:40.307Z","repository":{"id":38251445,"uuid":"261200461","full_name":"fluffynuts/node-tempdb","owner":"fluffynuts","description":"Piggy-backs off of PeanutButter.TempDb.Runner to provide a way for node tests to run against a temporary database","archived":false,"fork":false,"pushed_at":"2024-06-19T10:13:27.000Z","size":9739,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-22T11:47:45.535Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fluffynuts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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":"2020-05-04T14:16:03.000Z","updated_at":"2024-06-19T10:12:36.000Z","dependencies_parsed_at":"2024-06-19T19:28:07.929Z","dependency_job_id":"f0b3504a-f74b-4d74-9515-85d64c0d013d","html_url":"https://github.com/fluffynuts/node-tempdb","commit_stats":{"total_commits":61,"total_committers":2,"mean_commits":30.5,"dds":"0.42622950819672134","last_synced_commit":"dfeb0427df27e64d255e40b56c8a5ea4cfbe4549"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/fluffynuts/node-tempdb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluffynuts%2Fnode-tempdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluffynuts%2Fnode-tempdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluffynuts%2Fnode-tempdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluffynuts%2Fnode-tempdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fluffynuts","download_url":"https://codeload.github.com/fluffynuts/node-tempdb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluffynuts%2Fnode-tempdb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266698754,"owners_count":23970492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-10-03T01:38:33.608Z","updated_at":"2025-07-24T18:11:40.257Z","avatar_url":"https://github.com/fluffynuts.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-tempdb\n\n![Test results on Linux](https://github.com/fluffynuts/node-tempdb/workflows/Tests%20(linux)/badge.svg)\n![Test results on Windows](https://github.com/fluffynuts/node-tempdb/workflows/Tests%20(windows)/badge.svg)\n![npm downloads per week](https://img.shields.io/npm/dw/node-tempdb)\n\n## What is it?\n\nA node package, piggy-backing off of the .net package PeanutButter.TempDb.Runner,\nto provide a mechanism for node tests to run against a temporary database.\n\n## Supported databases\n- mysql\n- localdb\n- sqlite\n\nIf you have requests for other engines, please file an issue at \n[the PeanutButter GitHub repository](https://github.com/fluffynuts/PeanutButter). Engine\nsupport will only be considered if there is demand for it (one request _is_ demand :grin:)\n\n## Usage\n\n```typescript\nvar db = new TempDb(Databases.mysql);\nawait db.start();\n\n// configuration is available on db\nconst { host, user, password, database, port } = db.config;\n\n// if you're using knex, there's a convenience wrapper for config:\nconst knex = Knex(db.knexConfig);\n\n// now you have a clean, empty database!\n\n// later\nawait db.stop();\n```\n\n`TempDb` provides a static method `create` as a shorthand for construction and starting:\n```typescript\nvar db = await TempDb.create(Databases.mysql);\n```\n\n`TempDb` should be perfectly usable from JavaScript:\n\n```javascript\nlet db = await TempDb.create(\"mysql\");\n\n// later\nawait db.stop();\n```\n\n## Recommendations\n- `MySql` can take a few seconds to spin up. I suggest creating one TempDb in a `beforeAll()`\n  and tearing it down in an `afterAll()`\n- you probably already have some kind of db-schema migration strategy in place. Point it at your\n  new db and create a clean, useful database!\n\n## Troubleshooting MySql\n\n### Supported versions\nPeanutButter.TempDb.Runner has been tested with the following versions of MySql:\n- 5.6 (Windows, OSX)\n- 5.7 (Windows)\n- 8.0.20 (Gentoo Linux)\n\nEach of those versions has subtle differences which affect bootstrapping of the temporary instance.\nIf you find that `node-tempdb` is unable to bootstrap mysql for any reason, please open an issue\nat GitHub. You should be prepared to help me debug it!\n\nPeanutButter.TempDb.Runner will automagically find mysqld if:\n- it's in your path\n- you're on Windows and it's an installed service\n\nGenerally, this means:\n- an installed mysql server on Windows will _just work_\n- and installed mysql server on most Linux distros will _just work_\n- mysql installed via homebrew on OSX will work -- if you add the bin dir from the install\n  folder to your PATH (as soon as I have an OSX machine to test on I'm sure I can automate\n  this). `brew info mysql` should tell you where it's installed to. In the wild, I've seen\n  the path `/usr/local/mysql/bin` as the home where `mysqld` might live on OSX.\n  \n## Dev\n\nIf you want to work against this code, you should be able to:\n- clone\n- `npm test`\n\nand\n1. the tests should all run\n2. you should have a local copy of the used version of PeanutButter.TempDb.Runner\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluffynuts%2Fnode-tempdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluffynuts%2Fnode-tempdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluffynuts%2Fnode-tempdb/lists"}