-
Notifications
You must be signed in to change notification settings - Fork 27
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
Mocha CLI Args #63
Mocha CLI Args #63
Conversation
…o getReporterConstructor to increase explicitness
From the Travis run, looks like a few issues will need to be addressed:
Issue 1 I just need to know if it's alright to drop Mocha 4 🤞🏼 and issue 2 if anybody can take a look at that and see if it's clear what the reason for failure is I'd appreciate it. I should be able to address issue 3 pretty quickly tomorrow. |
@Jack-Barry 1. Yep, lets bump mochapack to a new major version and drop Mocha 4 |
Codecov Report
@@ Coverage Diff @@
## master #63 +/- ##
===========================================
+ Coverage 51.13% 65.13% +13.99%
===========================================
Files 26 42 +16
Lines 878 1219 +341
Branches 125 135 +10
===========================================
+ Hits 449 794 +345
+ Misses 414 403 -11
- Partials 15 22 +7
Continue to review full report at Codecov.
|
Some egg on my face: The files imported from Mocha as part of this PR were added while their repo was under If all's clear here, all that's left is a version bump. (Figured I'd save that until everything was resolved). |
I remember about this PR, but its quite big and I'm very busy this week. Hopefully I can review it the next week. |
Sounds good, thanks for the update amigo |
@Jack-Barry Bravo! Awesome work, thank you so much! |
Published new major version: |
@Jack-Barry Could you check and close issues that should be fixed by your PR in a new major version, or maybe just provide some feedback in the issues that have some impact from your PR? |
@larixer Thanks for merging this in, will make sure to make notes in applicable issue threads. Looks like I broke something here as per #65 but I figured there would be an untested bug or two to pop up. Will look into that one once a repro project is available or somebody else can provide a similar problem repro project. |
*/ | ||
|
||
// load requires first, because it can impact "plugin" validation | ||
handleRequires(argv.require) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Jack-Barry Is is intended that we invoke requires
BEFORE webpack compilation? It seems strange. The intention of the user is to use require for global setup before all tests run, but not before webpack compilation, after it. For example if user requires jsdom-global
it will setup browser-like environment and will break compilation, because webpack loaders will think they are invoked in the browser. And the user intent was to invoke jsdom-global
before all tests to provide the browser-environment for the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disregard, there is --include
for that
What's the problem this PR addresses?
Unfortunately, solving any one of these issues on its own wasn't necessarily an easy route to go, so they're all in a pretty big PR, however all issues needed to be addressed in some capacity.
7.1.0
(may not yet implement all arguments if they target CLI, but should be ready for all that target theMocha
constructor)MochaWebpack
toMochapack
to more clearly define it as the main class within the context of this projectMocha
andMochapack
classes are initialized with as many options up front as possible as opposed to configuring instances via long chains of function calls, to make CLI options added by Mocha later easier to supportrequire
interface #13, Add support for --file option #20, [Feature] Pass through arguments into Mocha #34 and [Feature] Allow usage of custom Mocha initializer #46How did you fix it?
parseArgv
andoptionsFromParsedArgs
functions to make their scope more focused and intent more clearparseArgv
,initMocha
under the hoodI'd like to ask for help from anyone interested to test this and/or contribute automated tests for particular arguments that you'd like to see covered. I didn't write any new tests for new arguments, however you can see which arguments are not passed directly to the Mocha constructor in this
types.ts
file. The arguments in theMochaCliOptions
interface must be handled in some way by Mochapack itself, which happens in the cli and initMocha functions. All other arguments are passed directly to the Mocha constructor, so any options that can be passed to it in aMochaOptions
object are directly handed off ininitMocha
.This makes it very clear whether Mochapack needs to do some special handling of Mocha args (that impact the CLI usage) or it just needs a quick update to the
mochaOptions.ts
file (until hopefully this gets merged, in which case Mochapack no longer has to update references to Mocha's CLI args).