{"id":25650681,"url":"https://github.com/flow-build/coverage-calculator","last_synced_at":"2026-06-10T20:31:31.154Z","repository":{"id":37074151,"uuid":"388489725","full_name":"flow-build/coverage-calculator","owner":"flow-build","description":null,"archived":false,"fork":false,"pushed_at":"2022-06-17T20:11:05.000Z","size":377,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-17T03:39:46.436Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/flow-build.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}},"created_at":"2021-07-22T14:23:39.000Z","updated_at":"2022-06-10T21:59:02.000Z","dependencies_parsed_at":"2022-06-24T19:34:31.726Z","dependency_job_id":null,"html_url":"https://github.com/flow-build/coverage-calculator","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/flow-build/coverage-calculator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flow-build%2Fcoverage-calculator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flow-build%2Fcoverage-calculator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flow-build%2Fcoverage-calculator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flow-build%2Fcoverage-calculator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flow-build","download_url":"https://codeload.github.com/flow-build/coverage-calculator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flow-build%2Fcoverage-calculator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34170162,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":"2025-02-23T15:17:47.234Z","updated_at":"2026-06-10T20:31:31.133Z","avatar_url":"https://github.com/flow-build.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flowbuild-coverage-calculator\n\nflowbuild-coverage-calculator is a plugin to test a workflow and analyse its history of processes. Also this plugin calculate tests node and connection coverage. It uses Cucumber to run automated tests and builtin scripts to calculate tests coverage.\n\n## Installation\n\nRun the following command in your terminal:\n```\nnpm install --save-dev flowbuild-coverage-calculator\n```\n\n## Usage\n\nAdd the following folder structure in your repository root:\n```\n├── tests\n|   ├── features\n|       ├── support\n```\n\nThen, inside the folder 'support' create a file 'world.js' with the following code inside:\n\n```js\n// tests/features/support/world.js\nconst { world } = require(\"flowbuild-coverage-calculator\");\n\n```\n\nFinally you need to add the following variables to your .env file (the values will depend on what environment and database you are using for the tests):\n\n```\nFLOWBUILD_URL=http://localhost:3000\nPOSTGRES_HOST=localhost\nPOSTGRES_USER=postgres\nPOSTGRES_PASSWORD=postgres\nPOSTGRES_DATABASE=workflow\n\n// these are just examples of variables values\n```\n\n### Running cucumber automated tests\n\nAs soon as you have all the dependencies and files as above, you need to create your test file inside the 'features' folder always with the extension '.feature' and using Gherkin sintaxe. Then, run the following command: \n\n```\nnpx cucumber-js tests/features/testBlueprint.feature\n\n// in this case 'testBlueprint.feature' is the test file created and has the same name as the blueprint (testBlueprint.json)\n```\n\nAfter this it will appear in the console the tests results. Besides that a file called 'worldData.json' will be created with the properties you chose to save in it. Also, inside the folder 'support' a new folder called 'coverageReports' will be created with json files. These files have the tests results coverage that you can check whenever you want.\n\n### Publish cucumber reports quietly\n\nAnd, if you don't want to publish your tests into cucumber's platform you can simply add a file on your repository root called 'cucumber.js' with the following code in it:\n```js\n// cucumber.js\nmodule.exports = { default: \"--publish-quiet\" };\n```\n\n### Extending CustomWorld\n\nIf you need to change or add new methods on CustomWorld you can simply add in your 'world.js' file the following code:\n```js\n// tests/features/support/world.js\nconst { world } = require(\"flowbuild-coverage-calculator\");\nconst { setWorldConstructor } = require(\"@cucumber/cucumber\");\n\nclass CustomWorld extends world.CustomWorld {\n  ...\n  // add your new methods here\n  ...\n}\n\nsetWorldConstructor(CustomWorld);\n```\nNote: if your methods have dependencies like 'logger', 'axios' or env variables, remember to add them at the top of your file as well.\n\n### Adding new steps\n\nIn case you need to add new steps for your tests you can add a file called 'steps.js' in your 'support' folder and simply put your new steps in it like the example:\n```js\n// tests/features/support/steps.js\nconst { Given } = require(\"@cucumber/cucumber\");\n\nGiven(\"an user with claim {string} is logged in\", { timeout: 60 * 1000 }, async function (claim) {\n  await this.getTokenClaim(claim);\n  return;\n});\n```\nNote: this is just an example and if you use a new method, like 'this.getTokenClaim(claim)' you need to add the method inside the file 'world.js'.\n\n### Printing a coverage table on console\n\nHaving a lot of files in the folder 'coverageReport' make it difficult to read one by one to see the results. To make it easier you can add the following script on your 'package.json' file:\n\n```json\n// package.json\n\"scripts\": {\n  ...\n  \"report\": \"node ./node_modules/flowbuild-coverage-calculator/scripts/report.js\",\n  ...\n}\n```\n\nAnd then run the following command to print the coverage table on console:\n\n```\nnpm run report\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflow-build%2Fcoverage-calculator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflow-build%2Fcoverage-calculator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflow-build%2Fcoverage-calculator/lists"}