0

I'm using cucumber and sublime text 3 to create some test cases but when I tried to create a snippet for them, the behavior was not as expected, when I call the snippet with tab button nothing happen. I had to figure out what happens and I found that the problem in the code is the $ in the step description.

My snippet:

<snippet>
  <content><![CDATA[
  'use strict';

  module.exports = function() {

    var Given = this.Given,
        When = this.When,
        Then = this.Then;

    Given(/^description$/, function(cb) {
        cb();
    });

    When(/^description$/, function(cb) {
        cb();
    });

    Then(/^description$/, function(cb) {
        cb();
    });
  };
  ]]></content>
    <tabTrigger>step</tabTrigger>
    <scope>source.js</scope>
    <description>To create a step in cucumber</description>
</snippet>

Then when I remove the $ in the description of step the snippet working very fine, but I need this symbol in the step. what I do in this case?

1

1 Answer 1

0

$ symbol in step description means end of the story line. You need to escape it if you want to use it with escape symbol. For example,

Given("^Unit price is 50\$ currently$")

If we use ^ at beginning and $ at the end then cucumber will do exact match for story and definitions.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.