JetBrains Rider 2019.1 Help

Cucumber.js

Cucumber.js is a test framework for behavior-driven JavaScript development. Cucumber.js tests are written in the human-readable Gherkin language and are stored in feature files that have the feature extension. JetBrains Rider integrates with Cucumber.js and recognizes features written in Gherkin so you can run Cucumber.js test right from the IDE.

Before you start

  1. Download and install Node.js.

  2. Install the Cucumber.js and Gherkin repository plugins on the Plugins page as described in Managing plugins.

Installing Cucumber.js

Creating test definitions

With JetBrains Rider, you can write step definitions both in JavaScript and in TypeScript. JetBrains Rider detects and highlights the steps where definitions are missing and suggests a quick-fix to generate them.

  1. Place the cursor at the step without a definition, press Alt+Enter, and select Create step definition or Create all step definitions.

    Create Cucumber.js step definitions: quick-fix

    Alternatively, hover the mouse over the step and use the links in the popup.

    Creating Cucumber.js step definitions: invoke actions from the pop-up
  2. In the dialog that opens, specify the name for the new file, the language to write the definitions in, and the version of Cucumber.js.

    Creating Cucumber.js step definitions: choose language version

    If such file already exists, JetBrains Rider displays a popup where you have to select a file to add the definition to or choose to create a new file.

With JetBrains Rider, you can jump between a file and the related test file or from a test result in the Test Runner Tab to the test.

  • Open the file in the editor and select Go To | Test or Go To | Test Subject from the context menu, or just press N/A.

  • To jump from a step in a .feature file to the step definition, press and hold Ctrl (or Cmd for macOS), hover over the step, and click the step when it turns into a link.

  • To jump from a test result to the test, select the test name in the Test Runner tab and choose Jump to Source from the context menu. The test file opens in the editor with the cursor placed at the test definition.

Configuring syntax highlighting

You can configure Cucumber.js-aware syntax highlighting according to your preferences and habits.

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), go to Editor | Color Scheme | Cucumber.

  2. Select the color scheme, accept the highlighting settings inherited from defaults or customize them as described in Configuring Colors and Fonts.

Last modified: 17 July 2019