Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Intellisense and custom steps file #4091

Closed Answered by sethvanwykJET
sethvanwykJET asked this question in Q&A
Discussion options

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.

You must be logged in to vote

Replies: 3 comments 6 replies

Comment options

Did you try this with your step file?

// in this file you can append custom step methods to 'I' object

export = function() {
return actor({

// Define custom steps here, use 'this' to access default methods of I.
// It is recommended to place a general 'login' function here.

});
}

You must be logged in to vote
5 replies
Comment options

Not sure what's different there from the example I provided 🤔

The code snippet is from the custom steps file

Comment options

Ah, I see the difference.

When I tried to adjust that, then I was met with an error that it's only compatible with typescript to change the export to look like that. Our current structure is Javascript.

image
Comment options

oh I see, just thought you're developing with TS.

Comment options

I'll update the base post with that detail for future reference

Comment options

Do you think this is something I should migrate to an issue, or keep it open as a discussion for now?

Comment options

did you try to run npx codeceptjs def?

You must be logged in to vote
1 reply
Comment options

Yes, no effect unfortunately

Comment options

You must be logged in to vote
0 replies
Answer selected by sethvanwykJET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /