Skip to content

Commit

Permalink
fix: missing methods from I actor (#3703)
Browse files Browse the repository at this point in the history
* fix: generate types command

* fix: step_file template
  • Loading branch information
kobenguyent committed Jun 20, 2023
1 parent 3fb39ae commit 97c2bf5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/command/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ module.exports = function() {
}
`;

const defaultActorTs = `// 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.
});
}
`;

module.exports = function (initPath) {
const testsPath = getTestRoot(initPath);

Expand Down Expand Up @@ -188,7 +200,7 @@ module.exports = function (initPath) {
// create steps file by default
// no extra step file for typescript (as it doesn't match TS conventions)
const stepFile = `./steps_file.${extension}`;
fs.writeFileSync(path.join(testsPath, stepFile), defaultActor);
fs.writeFileSync(path.join(testsPath, stepFile), extension === 'ts' ? defaultActorTs : defaultActor);
config.include.I = isTypeScript === true ? './steps_file' : stepFile;
print(`Steps file created at ${stepFile}`);

Expand Down

0 comments on commit 97c2bf5

Please sign in to comment.