Conversation
package.json
Outdated
| "./effects": "./lib/effects.js", | ||
| "./steps": "./lib/steps.js" | ||
| "./steps": "./lib/steps.js", | ||
| "./step": "./lib/step.js" |
There was a problem hiding this comment.
how about adding step export to index.js?
const { step } = require('codeceptjs')
this is how we access all internal API
codeceptjs/steps is userland API which is used inside tests, not custom helpers, or plugins
lib/output.js
Outdated
| if (step.comment) { | ||
| stepLine += colors.grey(step.comment.split('\n').join('\n' + ' '.repeat(4))) | ||
| } | ||
| try { |
There was a problem hiding this comment.
maybe better would be:
if (step instanceof Step) {
// ...
} elseif (typeof step == 'string') {
} else {
// incorrect step
}try catch is not the best approach here if we know where error can happen and how to avoid it
|
Something happened with tests in this 😢 |
|
Hey @kobenguyent , I have a better idea for this case How about create a Step that can execute arbitrary function See my implementation in #4781 here is what you can do: const FuncStep = require('codeceptjs/lib/steps/func')
const step = new Step(`expect "${JSON.stringify(actualValue)}" to not equal "${JSON.stringify(expectedValue)}"`);
step.setCallable(...) // actual assertion happens here?
output.step(step)you can actually add this step to promise chain const recordStep = require('codeceptjs/lib/steps/record')
const FuncStep = require('codeceptjs/lib/steps/func')
const step = new Step(`expect "${JSON.stringify(actualValue)}" to not equal "${JSON.stringify(expectedValue)}"`);
step.setCallable(...) // actual assertion happens here?
recordStep(step)In this case, all steps should are actual Steps so no need to pass strings |
Hi @DavertMik thanks for sharing this. So still do we need this PR just to handle the custom helpers for instance that are not yet adapted with new implementation? |
|
@kobenguyent if you think it is needed for backwards compatibility with Expect helper I'm ok |
Oh, if this shall be dropped in 4.0 then I'd say let's exclude this. |
Motivation/Description of the PR
Type of change
Checklist:
npm run docs)npm run lint)npm test)