-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Replace mocha --opts approach #15627
Comments
I've noticed that we are getting the warning in upstream test image:
|
Issues go stale after Mark the issue as fresh with If this issue is safe to close now please do so. Moderators: Add |
/remove-lifecycle stale |
I think the issue was still not solved, so I'm leaving it open. |
Issues go stale after Mark the issue as fresh with If this issue is safe to close now please do so. Moderators: Add |
/remove-lifecycle stale |
Issues go stale after Mark the issue as fresh with If this issue is safe to close now please do so. Moderators: Add |
Is your task related to a problem? Please describe.
According to the official mocha page, the
mocha --opts
are going to be deprecated [1]. We should consider changing that approach. When choosing the right way it should be taken into account having some parametrized approach to run test suites.Currently, if we want to have a new test suite, we need to create a new script in
scripts
part in package.json file and correspondingmocha-<something>.opts
file with the definition. We plan to have a lot of tests for devfiles (default ones and getting-started ones) so using that approach there will be a lot of files in the root and a package.json will grow quite large.The chosen approach should be easily adoptable by downstream.
[1] https://mochajs.org/#-opts-path
Describe the solution you'd like
There are several ways we can achieve that.
Use
--config
.mocharc.js instead of--opts
Documentation: https://mochajs.org/#-config-path
The
--config
in mocha allows to dynamically compose the structure that was saved in mocha.opts. Having that we can dynamically change parameters and test suites. Basically there will be filemocharc.js
with all the logic. [2]Use "parent" test suite class that will combine specified tests
This approach would require having all test suites exported e.g. as a function. Then the "parent" test suite file can execute only specified ones.
Using the environment variables
We can specify some environment variable that would contain a specific test(s) that should be executed. In package.json there would be just one script working with this parameter and generating suite that would be executed. (Can be done also with
--config
e.g. using .mocharc.json [3]).[2] https://github.com/mochajs/mocha/blob/master/example/config/.mocharc.js
[3] https://github.com/mochajs/mocha/blob/master/example/config/.mocharc.json
Describe alternatives you've considered
There can be also other alternatives - those can be also discussed during the investigation part of that issue.
The text was updated successfully, but these errors were encountered: