Pest: Proposal: pest-plugin-init

Created on 29 May 2020  路  13Comments  路  Source: pestphp/pest

After merging @fetzi's work on plugins. Would be cool to develop a pest-plugin-init that would work the following way:

  1. In applications without tests: ./vendor/bin/pest --init
  2. Boostraps the tests folder
  3. Create a configuration file
enhancement question

Most helpful comment

Nice!
Could we get rid of the dashes to provide a cleaner CLI experience ./vendor/bin/pest init ?

Some more thought about CLI syntax here: #10

All 13 comments

This would be nice. 馃憤 I'd be happy to take a look when the plugin PR is merged.

Nice!
Could we get rid of the dashes to provide a cleaner CLI experience ./vendor/bin/pest init ?

Some more thought about CLI syntax here: #10

Dashes are for options. So you are right

@owenvoke are you still on it?

I was, but was struggling on a way to implement it with the current plugin API.

If it uses HandlesArguments, then it may be run after other plugins which is not desired as it basically just needs to be a separate command.

Yes, maybe this one shouldn't be a plugin and should be included in the core. @nunomaduro what do you think?

Should be a plugin that exists by default on the core. 馃槉

Ok, I think we may need to modify the plugin API to allow this then. 馃憤

@owenvoke I think that handleArguments is the right place for that. It won't matter if another plugin gets executed beforehand.

@fetzi, or afterwards? 馃 Just seems a bit weird for init to also run tests. But if so, I'm happy to just do that.

@owenvoke Well, you can exit(0) when you are handling the arguments of the init right?

The watch plugin will also not continue to execute the tests directly. So I think exit(0) is good for the init plugin.

Just to check, I assume that if that's at the end of the handleArguments() method, then the addOutput() wouldn't be called? Because it would just exit.

Ignore that, addOutput() is after the test suite runs so there would be no point in including that. 馃う Thinking about this, do we have an easy way of adding output to the handleArguments() method? 馃憤


Ok, another issue, if running pest init in a new repo that doesn't contain a tests directory then it throws an error.
image

Anyway, I've pushed a first version here:
https://github.com/pestphp/pest-plugin-init/pull/1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AlexMartinFR picture AlexMartinFR  路  6Comments

khalyomede picture khalyomede  路  7Comments

maurobonfietti picture maurobonfietti  路  5Comments

Synchro picture Synchro  路  5Comments

nunomaduro picture nunomaduro  路  4Comments