request-promise + co API trigger in protractor test
<p>I want to call module.api.create from my protractor test. Referring this solution:- 
<a href="https://stackoverflow.com/questions/34835940/chain-multiple-node-http-request">Chain multiple Node http request</a>  I am using request-promise + co like this:-</p>

<pre><code>//api/module1.js
var co = require('co');
var rp = require('request-promise');

exports.create =  co(function* def() {
    var response, token;
    urlLogin.body.username = username;
    response = yield rp(urlLogin);
    //extract token and run other APIs
    ...
}).catch(err =&gt; console.log);
</code></pre>

<p>And </p>

<pre><code>//api/api.js 
var module1= require('./module1'),
exports.module1= function (){
  return module1;
}; 
</code></pre>

<p>In my Spec/Test I am adding  </p>

<pre><code>api = require('../../api/api');
api.module1.create;  
</code></pre>

<p>Issue i am facing is than even without calling the "api.module1.create;" line, the require line "api = require('../../api/api');" is calling the create automatically every-time the test is executed</p>