-
-
Couldn't load subscription status.
- Fork 751
Intellisense and custom steps file #4091
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 3 comments 6 replies
-
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.
});
}
Beta Was this translation helpful? Give feedback.
All reactions
-
Not sure what's different there from the example I provided 🤔
The code snippet is from the custom steps file
Beta Was this translation helpful? Give feedback.
All reactions
-
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.
imageBeta Was this translation helpful? Give feedback.
All reactions
-
oh I see, just thought you're developing with TS.
Beta Was this translation helpful? Give feedback.
All reactions
-
I'll update the base post with that detail for future reference
Beta Was this translation helpful? Give feedback.
All reactions
-
Do you think this is something I should migrate to an issue, or keep it open as a discussion for now?
Beta Was this translation helpful? Give feedback.
All reactions
-
did you try to run npx codeceptjs def?
Beta Was this translation helpful? Give feedback.
All reactions
-
Yes, no effect unfortunately
Beta Was this translation helpful? Give feedback.
All reactions
-
Beta Was this translation helpful? Give feedback.