{"id":15285674,"url":"https://github.com/gherking/gpc-test-data","last_synced_at":"2025-05-07T03:45:39.876Z","repository":{"id":42858740,"uuid":"474097066","full_name":"gherking/gpc-test-data","owner":"gherking","description":"This precompiler can load external data (JSON, CSV, or XLS/XLSX) into exmaples table.","archived":false,"fork":false,"pushed_at":"2025-03-09T04:29:02.000Z","size":436,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T06:02:13.463Z","etag":null,"topics":["csv","cucumber","excel","feature-file","gherkin","gherking","gpc","hacktoberfest","json","precompiler","typescript"],"latest_commit_sha":null,"homepage":"https://gherking.github.io/gpc-test-data/","language":"TypeScript","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/gherking.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-03-25T17:04:17.000Z","updated_at":"2025-03-09T04:28:40.000Z","dependencies_parsed_at":"2024-01-11T06:42:22.086Z","dependency_job_id":"7e228adc-386f-49a5-849f-96e0f903f389","html_url":"https://github.com/gherking/gpc-test-data","commit_stats":{"total_commits":11,"total_committers":3,"mean_commits":"3.6666666666666665","dds":"0.36363636363636365","last_synced_commit":"db5b0fdb82397be7e88b015c6bcf57d24a65af8f"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":"gherking/gpc-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gherking%2Fgpc-test-data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gherking%2Fgpc-test-data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gherking%2Fgpc-test-data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gherking%2Fgpc-test-data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gherking","download_url":"https://codeload.github.com/gherking/gpc-test-data/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251879170,"owners_count":21658705,"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","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":["csv","cucumber","excel","feature-file","gherkin","gherking","gpc","hacktoberfest","json","precompiler","typescript"],"created_at":"2024-09-30T15:07:06.432Z","updated_at":"2025-05-07T03:45:39.858Z","avatar_url":"https://github.com/gherking.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gpc-test-data\n\n![Downloads](https://img.shields.io/npm/dw/gpc-test-data?style=flat-square) ![Version@npm](https://img.shields.io/npm/v/gpc-test-data?label=version%40npm\u0026style=flat-square) ![Version@git](https://img.shields.io/github/package-json/v/gherking/gpc-test-data/master?label=version%40git\u0026style=flat-square) ![CI](https://img.shields.io/github/actions/workflow/status/gherking/gpc-test-data/ci.yml?branch=master\u0026label=ci\u0026style=flat-square) ![Docs](https://img.shields.io/github/actions/workflow/status/gherking/gpc-test-data/docs.yml?branch=master\u0026label=docs\u0026style=flat-square)\n\nThis precompiler can load external data (JSON, CSV, or XLS/XLSX) into the examples table.\n\n## Usage\n\n```javascript\n'use strict';\nconst compiler = require('gherking');\nconst { default: TestData } = require('gpc-test-data');\n\nlet ast = await compiler.load('./features/src/login.feature');\nast = await compiler.process(\n  ast,\n  new TestData({\n    defaultValue: \"-\"\n  })\n);\nawait compiler.save('./features/dist/login.feature', ast, {\n  lineBreak: '\\r\\n'\n});\n```\n\n```typescript\n'use strict';\nimport {load, process, save} from \"gherking\";\nimport TestData from \"gpc-test-data\";\n\nlet ast = await load(\"./features/src/login.feature\");\nast = await process(\n  ast,\n  new TestData({\n    defaultValue: \"-\"\n  })\n);\nawait save('./features/dist/login.feature', ast, {\n  lineBreak: '\\r\\n'\n});\n```\n\n## Tags\n\nIn the feature file, for each Examples, one of the following tags can be set:\n\n* `@load_json(path)` to load the data from a JSON file\n* `@load_csv(path)` to load the data from a CSV file\n* `@load_xls(path)` to load the data from an XLS/XLSX file, from the first sheet\n* `@load_xls(path,sheet)` to load the data from an XLS/XLSX file, from the given sheet\n* `@load_http(url)` to load the data from an HTTP source (a JSON response of an object array)\n\nFor each tag, the path must be either a relative (from `cwd`) or an absolute path to the file, including the file name and extension.\n\n## Formats\n\nThere are some restrictions on the various data formats:\n\n* For JSON, the content of the JSON file should be an array of objects, where the key of the object properties will be mapped to the examples columns.\n* For CSV and XLS/XLSX, the first non-empty row must contain the header/column names, which will be mapped to the examples columns.\n* For CSV, the [csv-parse](https://www.npmjs.com/package/csv-parse) tool is used to parse the CSV files, see its documentation for the particular specialties of its parsing and requirements for a CSV file (for parsing, an adaptive configuration is set - columns, skipping empty lines, trimming, auto-BOM, auto-delimiter).\n* For XLS/XLSX, the [xlsx](https://www.npmjs.com/package/xlsx) tool is used to parse the XLS/XLSX files, see its documentation for the particular specialties of its parsing and requirements for an XLS/XLSX file (for parsing, an adaptive configuration if set - removing blank rows, skipping hidden rows, parsing number; additionally the CSV parsing options from the previous point).\n\n## Configuration\n\nThe precompiler supports the following configuration options to be set:\n\n|       Option       |       Type       | Description                                                                                           | Default |\n| :----------------: | :--------------: | :---------------------------------------------------------------------------------------------------- | :------ |\n|     `keepTag`      |    `boolean`     | Whether the load-tags should be kept or removed.                                                      | `false` |\n|   `defaultValue`   | `string\\|number` | The default value to be added to the table, if a column/value is not found.                           | `\"\"`    |\n|    `appendData`    |    `boolean`     | Whether the loaded data should be appended to the existing rows of the examples table or overwritten. | `true`  |\n|  `ignoreKeyCase`   |    `boolean`     | Whether the casing of the example columns and data columns should be ignored.                         | `true`  |\n| `addSourceComment` |    `boolean`     | Whether a comment should be added to the example, indicating the source and the data type.            | `false` |\n|  `allowEmptyData`  |    `boolean`     | Whether empty data files are allowed to be loaded, or error should be thrown.                         | `false` |\n\n## Other\n\nThis package uses [debug](https://www.npmjs.com/package/debug) for logging, use `gpc:test-data` :\n\n```shell\nDEBUG=gpc:test-data* gherking ...\n```\n\nFor detailed documentation see the [TypeDocs documentation](https://gherking.github.io/gpc-test-data/).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgherking%2Fgpc-test-data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgherking%2Fgpc-test-data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgherking%2Fgpc-test-data/lists"}