{"id":20560128,"url":"https://github.com/tzurp/cleanup-total","last_synced_at":"2025-10-08T08:29:11.773Z","repository":{"id":42525870,"uuid":"385212604","full_name":"tzurp/cleanup-total","owner":"tzurp","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-22T10:50:04.000Z","size":454,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-22T11:40:44.211Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tzurp.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,"zenodo":null}},"created_at":"2021-07-12T10:43:00.000Z","updated_at":"2025-07-22T10:50:07.000Z","dependencies_parsed_at":"2024-11-16T03:53:19.026Z","dependency_job_id":"eab129e9-f3f7-4fc9-ab07-96758676795c","html_url":"https://github.com/tzurp/cleanup-total","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/tzurp/cleanup-total","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tzurp%2Fcleanup-total","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tzurp%2Fcleanup-total/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tzurp%2Fcleanup-total/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tzurp%2Fcleanup-total/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tzurp","download_url":"https://codeload.github.com/tzurp/cleanup-total/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tzurp%2Fcleanup-total/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266507417,"owners_count":23940070,"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-22T02:00:09.085Z","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-11-16T03:53:13.773Z","updated_at":"2025-10-08T08:29:11.766Z","avatar_url":"https://github.com/tzurp.png","language":"TypeScript","funding_links":[],"categories":["Plugins"],"sub_categories":["Services"],"readme":"# cleanup-total\n\nWith the `cleanup-total` service for [webdriver.io](https://webdriver.io/), you can easily ensure proper cleanup after each test. The service provides a systematic way to mark entities for deletion immediately after creation. This is particularly useful when tests involve creating complex structures, such as a bank account with an investment plan and a deposit. Without proper cleanup, attempting to delete the account may result in errors, such as a refusal due to the account not being empty. However, with __cleanup-total__, entities are deleted in the correct order, ensuring that tests clean up after themselves and do not interfere with each other.\n\n## Installation\nThe easiest way to install this module as a (dev-)dependency is by using the following command:\n\n```\nnpm install wdio-cleanuptotal-service --save-dev\n```\n\n## Usage\n\nAdd wdio-cleanuptotal-service to your `wdio.conf.ts`:\n\n```typescript\nexport const config: WebdriverIO.Config = {\n  // ... other options\n\n  services: ['cleanuptotal']\n\n  // ... other options\n};\n```\n\nor with the service options:\n\n```typescript\nexport const config: WebdriverIO.Config = {\n  // ... other options\n\n  services: [\n    [\n      'cleanuptotal',\n      {\n        // Use a custom logger function to write messages to the test report\n        customLoggerMethod: console.log(), // TODO: replace with your own logger function if needed\n\n        // Only write to the log when an error occurs to reduce clutter\n        logErrorsOnly: false, // TODO: consider changing to 'true' if you have too many messages in the report\n      }\n    ]\n  ]\n\n  // ... other options\n};\n```\n\n## Usage in test\n\nYou can import the __cleanuptotal__ service wherever it's needed, whether it's in your test file or any other class.\n\n```typescript\nimport { cleanuptotal } from \"wdio-cleanuptotal-service\";\n\nit(\"should keep things tidy\", () =\u003e {\n  // ...\n\n  // Create an account and add it to the cleanup list for deletion after the test\n  const accountId = createAccount(\"John Blow\");\n  cleanupTotal.addCleanup(async () =\u003e {\n    await deleteAccount(accountId);\n  });\n\n  // Add an investment plan to the account and add it to the cleanup list\n  addInvestmentPlan(accountId, \"ModRisk\");\n  cleanupTotal.addCleanup(async () =\u003e {\n    await removeInvestmentPlan(accountId);\n  });\n\n  // Deposit funds into the account and add it to the cleanup list\n  deposit(accountId, 1000000);\n  cleanupTotal.addCleanup(async () =\u003e {\n    await undoDeposit(accountId);\n  });\n\n  // ...\n\n});\n\n// Note that the actual cleanup code will be executed after the test is complete\n```\n\n## Typescript support\n\nTypescript is supported for this plugin.\n\n## Support\n\nFor support and suggestions, feel free to contact me at [tzur.paldi@outlook.com](mailto:tzur.paldi@outlook.com).\n\n📬 Maintained by [Tzur Paldi](https://github.com/tzurp) — explore my GitHub profile for more tools.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftzurp%2Fcleanup-total","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftzurp%2Fcleanup-total","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftzurp%2Fcleanup-total/lists"}