title: How do i share my World instance across multiple step definition files in CucumberJS?
body: <p>I am implementing a CucumberJS scenario which uses multiple steps across two different step definition files. The first step sets some variables on the World which have to be used by a step in the other step definition file. </p>
  
  <p>The variable gets set correctly but when the step on the other file tries to read it it's undefined. Any ideas how to solve this apart from merging the step definition files?</p>
  
  <p>example:</p>
  
  <p>world.js</p>
  
  <pre><code>var World = function World() {
    this.client = '';
  };
  
  module.exports.World = World;
  </code></pre>
  
  <p>test.feature</p>
  
  <pre><code>Given a variable A
  Then some other step
  </code></pre>
  
  <p>step1.steps.js</p>
  
  <pre><code>module.exports = function () {
      this.World = require(process.cwd() + '/test/features/support/world').World;
  
      this.Given(/^a Variable A$/, function () {
          this.client = 'abc';
      });
  };
  </code></pre>
  
  <p>step2.steps.js</p>
  
  <pre><code>module.exports = function () {
      this.World = require(process.cwd() + '/test/features/support/world').World;
  
      this.Then(/^some other step$/, function () {
          console.log(this.client);
      });
  };
  </code></pre>