Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prettier-plugin-gherkin

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prettier-plugin-gherkin

This prettier plugin format your gherkin (`.feature` files) documents.

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
39K
increased by26.28%
Maintainers
2
Weekly downloads
 
Created
Source

prettier-plugin-gherkin

This prettier plugin format your gherkin (.feature files) documents.

Example of changes:

@accountability
@accountability-json
Feature: accountability
    accounts should always be good
    @truncateTables
    Scenario: Check accountability
        # Insert fixtures
        Given the following fixtures files are loaded:
            | 10.contracts.yml            |
            | 20.wallet.yml               |
            | 30.tax.yml |

        Given I inject the header "authorization" with value 'Bearer some-token'

        And I inject the header "accept" with value "application/json"

        Given I create an order
            Then the response status code should be 200
            When I pay the latest order
        And I refund the last payment and transaction list with transactions:
                """
            [{"name": "card",
                    "credit": 5000
                }
            ]
            """

Will be formatted to:

@accountability
@accountability-json
Feature: accountability
    accounts should always be good

    @truncateTables
    Scenario: Check accountability
        # Insert fixtures
        Given the following fixtures files are loaded:
            | 10.contracts.yml |
            | 20.wallet.yml    |
            | 30.tax.yml       |

        Given I inject the header "authorization" with value 'Bearer some-token'
        And I inject the header "accept" with value "application/json"

        Given I create an order
        Then the response status code should be 200

        When I pay the latest order
        And I refund the last payment and transaction list with transactions:
            """
            [
                {"name": "card",
                    "credit": 5000
                }
            ]
            """

Options

This plugin has a single options:

escapeBackslashes

default to false

If false, all escaped backslash will be transformed to simple backslash : \\\ If true, all backslash will be espaced : \\\

This option may due to the parser(see issue) and is here because of an inconsistence between the gherkin reference, that said that:

if you need a \, you can escape that with \\.

and the tooling that accept unescaped \, including the cucumber parser used under the hood.

You may want to check your code base and be consistent : if you use simple backslash, keep the default option, if you escape all backslash, then set this option to true.

Documentation

Prettier plugin documentation

Gherkin AST schema

Gherkin AST schema

Useful resources on Gherkin language

Test datas

Test datas can be found here : https://github.com/cucumber/common/tree/main/gherkin/testdata

Keywords

FAQs

Package last updated on 03 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc