Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature ✨] Configuration params through console #320

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

beluamat29
Copy link
Collaborator

@beluamat29 beluamat29 commented Dec 1, 2024

What

Adding the ability of sending configuration parameters when running a test through the console. The introduced parameters are:

  • fail fast enabled option: available through -f or --fail-fast commands
  • random order enabled option: available through -r or --randomize commands
  • change default language option: available through -l en/es/it or --language en/es/it commands

These commands can be combined using either their long or short versions and in any order.

Validations and examples:

Running a single test using no config, fail fast enabled, randomize enabled, Italian language enabled and the combination of them 3

image image image image image

Running multiple tests paths sending a configuration
image

Running all tests sending a configuration
image

Link to issue(s)

Contribution guidelines

@beluamat29 beluamat29 force-pushed the config-params-through-console branch from 1e2b29f to b668ab2 Compare December 2, 2024 13:02
@beluamat29 beluamat29 marked this pull request as ready for review December 2, 2024 13:06
Copy link

codeclimate bot commented Dec 7, 2024

Code Climate has analyzed commit f432926 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 98.6% (50% is the threshold).

This pull request will bring the total coverage in the repository to 98.2% (0.0% change).

View more on Code Climate.

Comment on lines +1 to +4
/**
* I transform a list of console parameters into a valid configuration object.
* I can also differentiate between path parameters and configuration parameters.
*/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this comment to be JSdoc, it has to be placed before line 8

Comment on lines +187 to +189
isFailFastParam,
isRandomizeParam,
isLanguageParam,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move these three functions outside of utils. My idea of the utils module is to put logic that does not belong to the testy domain.

What about moving them to the ParametersParser module?


Una suite de test no es más que un archivo cuyo nombre finaliza con `_test.js` y tiene la siguiente forma:

```javascript
import { suite, test, assert } from '@pmoo/testy';
import { suite, test, assert } from "@pmoo/testy";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file has a lot of changes that seem to be automatic. Could we revert them and keep only the new changes?

*/
import { isFailFastParam, isLanguageParam, isRandomizeParam } from '../utils.js';

const LANGUAGE_OPTIONS = ['es', 'en', 'it'];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, the list of available languages is dynamic. It depends on the locale files you create (see I18n::supportedLanguages). Would it be possible to keep this list dynamic?

}

static handle(configurationParam) {
throw new Error(`Cannot parse invalid run configuration parameter ${configurationParam}. Please run --help option to check available options.`);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💟 for this empathetic message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants