Skip to content

Intellisense and custom steps file using Javascript #4153

Closed
@sethvanwykJET

Description

@sethvanwykJET

Discussed in #4091

Originally posted by sethvanwykJET December 28, 2023
Please note. This issue is Javascript specific. It doesn't seem to occur in typescript repos

So I've run into a bit of a nuisance.

I noticed that any code we add into the custom steps file isn't detected by VS Code

https://codecept.io/pageobjects/#actor

This is leading to a lot of confusion and sometimes team members removing required code due to their IDE telling them it's redundant.

Our codebase uses Javascript

module.exports = function() {
  return actor({
    async myAsyncFunction(param) {
      // logic goes here
    },

    async myOtherFunction(param) {
      await this.myAsyncFunction(param)
    }
  });
};

In this example there will are 2 problems.

One, You can't deep-link back to myAsyncFunction by cmd+clicking it (MacOS)

And two, the IDE will berate you for using await on a non-promise Refactor this redundant 'await' on a non-promise.

These are example from within the steps file itself, but it extends past that.

When using these functions inside of tests they also don't support intellisense and complain about using await on non-promises.

Additional note, the native CodeceptJS functions do support intellisense, this only happens for code that's new in the steps file.

The problem does not seem to exist in other IDE's. Colleagues that use Jetbrains seem to be able to use this without issues.

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