bigbite / wp-cypress

WordPress end to end testing with Cypress.io.
MIT License
86 stars 19 forks source link

Write command output to `stdout` - Typos/grammar mistakes - JSDoc comments improvements #114

Closed over-engineer closed 1 year ago

over-engineer commented 1 year ago

Description

Fixes #113.

The first 4 commits are minor (typos, grammar mistakes, and JSDoc comments). The actual change (related to #113) is in 96ef4ff and affects the following files:

It basically introduces the -w (or --write-to-stdout) flag for the wp command:

program
  .command('wp')
  .description('Execute the WordPress CLI in the running container')
  .option('<command>', 'The WP-CLI command to execute')
  .option('-w,--write-to-stdout', 'Whether to write the output to stdout')
  .action((options) => {
    const command = options.args.join(' ');
    wp(command, packageDir, logFile, !!options.writeToStdout);
  });

and adds an additional (boolean) parameter for that flag to:

The new writeToStdout parameter is going to be false, by default. We're only setting the flag for the WP Cypress commands in lib/cli/cypress-support/commands.js.

So, we're essentially changing this:

wp(command) {
  cy.exec(`${wpCypress} wp "${command}"`);
}

to that:

wp(command) {
  cy.exec(`${wpCypress} wp --write-to-stdout "${command}"`);
}

I've tested the changes described in this PR on a couple of projects (and with my own Cypress commands) and AFAICT everything is working as expected.

Let me know if you need any more information! 🙂

Change Log

Screenshots/Videos

N/A

Types of changes (if applicable):

Checklist (if applicable):