Hey,
I had some troubles with creating my own helper I’d like to share.
I created one with codeceptjs gh command and then run the whole suite with codeceptjs run --steps.
This is the error I got:
Error: Could not load helper UrlHelper from module './helper/UrlHelper'
Cannot find module './helper/UrlHelper'
The fix for this was changing this line in container.js to:
let HelperClass = require(helperModule = config[helperName].require || './helper/'+helperName);
After this, the error was:
Error: Could not load helper UrlHelper from module './url_helper.js'
Cannot find module './url_helper.js'
I had a feeling that it tried to look for my module in /usr/local/lib/node_modules/codeceptjs (where container.js is), so I replaced ./url_helper.js in my package.json with an absolute path to the file. The file was loaded correctly after doing this.
The next error was that it couldn’t find codeceptjs/helper module that I require in my url_helper.js file, so I replaced it with an ugly absolute path to it /usr/local/lib/node_modules/codeceptjs/lib/helper. The helper was loaded correctly after this.
While it all works now for me, relying on absolute paths isn’t really a solution so I think I must be doing something wrong. Any help will be appreciated! I’m on node v4.2.3 if that helps.
Thanks!
Hey,
I had some troubles with creating my own helper I’d like to share.
I created one with
codeceptjs ghcommand and then run the whole suite withcodeceptjs run --steps.This is the error I got:
The fix for this was changing this line in container.js to:
After this, the error was:
I had a feeling that it tried to look for my module in
/usr/local/lib/node_modules/codeceptjs(wherecontainer.jsis), so I replaced./url_helper.jsin mypackage.jsonwith an absolute path to the file. The file was loaded correctly after doing this.The next error was that it couldn’t find
codeceptjs/helpermodule that I require in myurl_helper.jsfile, so I replaced it with an ugly absolute path to it/usr/local/lib/node_modules/codeceptjs/lib/helper. The helper was loaded correctly after this.While it all works now for me, relying on absolute paths isn’t really a solution so I think I must be doing something wrong. Any help will be appreciated! I’m on node
v4.2.3if that helps.Thanks!