Skip to content

Helper loading issues #10

Closed
Closed
@pim

Description

@pim

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions