{"id":15177464,"url":"https://github.com/dex4er/js-tap-given","last_synced_at":"2026-02-04T15:06:48.753Z","repository":{"id":65514459,"uuid":"82409777","full_name":"dex4er/js-tap-given","owner":"dex4er","description":"Given-When-Then BDD for TAP","archived":false,"fork":false,"pushed_at":"2017-09-29T15:05:47.000Z","size":47,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-26T16:09:47.101Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/tap-given","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/dex4er.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}},"created_at":"2017-02-18T19:09:48.000Z","updated_at":"2017-02-18T19:10:23.000Z","dependencies_parsed_at":"2023-01-26T21:05:14.961Z","dependency_job_id":null,"html_url":"https://github.com/dex4er/js-tap-given","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/dex4er/js-tap-given","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dex4er%2Fjs-tap-given","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dex4er%2Fjs-tap-given/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dex4er%2Fjs-tap-given/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dex4er%2Fjs-tap-given/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dex4er","download_url":"https://codeload.github.com/dex4er/js-tap-given/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dex4er%2Fjs-tap-given/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262099728,"owners_count":23258670,"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":[],"created_at":"2024-09-27T14:22:54.643Z","updated_at":"2026-02-04T15:06:43.716Z","avatar_url":"https://github.com/dex4er.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## tap-given\n\n[![Build Status](https://secure.travis-ci.org/dex4er/js-tap-given.svg)](http://travis-ci.org/dex4er/js-tap-given) [![Coverage Status](https://coveralls.io/repos/github/dex4er/js-tap-given/badge.svg)](https://coveralls.io/github/dex4er/js-tap-given) [![npm](https://img.shields.io/npm/v/tap-given.svg)](https://www.npmjs.com/package/tap-given)\n\nThis module provides [tap](https://www.npmjs.com/package/tap) API with\n[Mocha-like DLS](http://www.node-tap.org/mochalike/) as Given-When-Then style\nfor BDD tests.\n\n### Requirements\n\nThis module requires Node \u003e= 4.\n\n### Installation\n\n```shell\nnpm install tap-given\n```\n\n### Usage\n\n__Feature__: TDD in Given-When-Then style\n\n__Scenario__: Basic scenario\n\n__Given__ `examples/test.js` file:\n\n```js\nconst t = require('tap')\nrequire('tap-given')(t)\nrequire('chai').should()\n\nFeature('TDD in Given-When-Then style for TAP', () =\u003e {\n  Scenario('Basic scenario', () =\u003e {\n    let a, b, c\n\n    Given('first value', () =\u003e {\n      a = 2\n    })\n\n    And('second value', () =\u003e {\n      b = 21\n    })\n\n    When('I do multiplication operation', () =\u003e {\n      c = a * b\n    })\n\n    Then('the result is correct', () =\u003e {\n      c.should.equal(42)\n    })\n  })\n})\n```\n\n__When__ I run `tap` command:\n\n```sh\n$ tap -R spec examples/test.js\n```\n\n__Then__ following output is produced:\n\n```\nexamples/test.js\n  Feature: TDD in Given-When-Then style for TAP\n    Scenario: Basic scenario\n      ✓ Given first value\n      ✓   ‎‎And second value\n      ✓  ‎When I do multiplication operation\n      ✓  ‎Then the result is correct\n\n\n  4 passing (233.031ms)\n```\n\n### Functions\n\n`Feature` function is an alias to `describe` function and might be optional.\n\n`Scenario` function is an alias to `context` function. It usually provides a\ncontext for its steps then real `function () {}` might be used instead arrow\n`() =\u003e {}` notation.\n\n`Given`, `When`, `Then` and `And` functions are aliases to `it` function.\n\n`Before`, `beforeEach`, `After` and `afterEach` functions are also provided\nand are optional.\n\nFor `Before` and `After` functions the first argument is optional.\n\nAll functions except `BeforeEach` and `AfterEach` add some prefix to the\ndescription of the step.\n\n### Typescript\n\nUse following syntax instead `require`:\n\n```ts\nimport * as tap from 'tap'\nimport { tapGiven } from 'tap-given'\ntapGiven(tap)\n```\n\n### Linter\n\nInstall `eslint-plugin-tap-given` module and use in `package.json`:\n\n```js\n{\n  \"standard\": {\n    \"plugins\": [ \"tap-given\" ],\n    \"env\": [ \"tap-given/tap-given\" ]\n  }\n}\n```\n\nor:\n\n```js\n{\n  \"eslintConfig\": {\n    \"plugins\": [ \"tap-given\" ],\n    \"env\": {\n      \"tap-given/tap-given\": true\n    }\n  }\n}\n```\n\nWithout plugin:\n\n```js\n{\n  \"standard\": {\n    \"globals\": [\n      \"After\",\n      \"AfterEach\",\n      \"And\",\n      \"Before\",\n      \"BeforeEach\",\n      \"Feature\",\n      \"Given\",\n      \"Scenario\",\n      \"Then\",\n      \"When\"\n    ]\n  }\n}\n```\n\nor:\n\n```js\n/* global Feature, Scenario, Given, When, Then, And, Before, BeforeEach, After, AfterEach */\n```\n\n### License\n\nCopyright (c) 2017 Piotr Roszatycki \u003cpiotr.roszatycki@gmail.com\u003e\n\n[MIT](https://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdex4er%2Fjs-tap-given","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdex4er%2Fjs-tap-given","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdex4er%2Fjs-tap-given/lists"}