-
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
Update logic used to parse the args passed into the test frameworks #1917
Update logic used to parse the args passed into the test frameworks #1917
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1917 +/- ##
==========================================
+ Coverage 74.74% 75.03% +0.28%
==========================================
Files 302 307 +5
Lines 13721 14058 +337
Branches 2436 2493 +57
==========================================
+ Hits 10256 10548 +292
- Misses 3330 3373 +43
- Partials 135 137 +2
Continue to review full report at Codecov.
|
5ccafa5
to
0bd432e
Compare
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.
Looks pretty good, sorry it took me so long to complete my review. I have a few things that should be looked at, but for the most part it looks just fine (and I love the doi being added here!).
On the subject of dependency of injection, I see a common pattern where we simply inject the entire ServiceContainer into the constructor of our classes.
Question for you here:
Wouldn't we want to inject the exact containers we need for this class and no more?
For instance:
constructor(
@inject(IArgumentsHelper) private argsHelper: IArgumentsHelper,
@inject(ITestRunner) private testRunner: ITestRunner,
...etc...
)
?
@@ -58,14 +58,14 @@ export class AnalysisEngineDownloader { | |||
private async downloadFile(location: string, fileName: string, title: string): Promise<string> { | |||
const uri = `${location}/${fileName}`; | |||
this.output.append(`Downloading ${uri}... `); | |||
const tempFile = await createTemporaryFile(downloadFileExtension); | |||
const tempFile = await this.fs.createTemporaryFile(downloadFileExtension); |
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.
Love it - temp file that can be disposed to clean itself up, great.
import { IArgumentsHelper } from '../types'; | ||
|
||
@injectable() | ||
export class ArgumentsHelper implements IArgumentsHelper { |
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.
Is this a bespoke version of something akin to getopt
? Could we just make use of a known library that would do this for us? Something that would be extensible enough to add whatever custom processing we need to apply perhaps.
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.
- Too late in the game to add new deps
- I don't see the need to create nor use something generic, as this approach of parsing args is a bad approach. But this is what we have today in terms of running tests.
if (Array.isArray(argumentToRemoveOrFilter)) { | ||
argumentToRemoveOrFilter.forEach(item => { | ||
if (OptionsWithArguments.indexOf(item) >= 0) { | ||
optionsWithoutArgsToRemove.push(item); |
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.
Did you mean to push the value into optionsWithArgsToRemove
here?
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.
(Might want to make the names less similar here to avoid this in future, nonArgOptions, argOptions, something like that).
if (Array.isArray(argumentToRemoveOrFilter)) { | ||
argumentToRemoveOrFilter.forEach(item => { | ||
if (OptionsWithArguments.indexOf(item) >= 0) { | ||
optionsWithoutArgsToRemove.push(item); |
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.
optionsWithArgsToRemove
again?
@d3r3kk Please re-review. |
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.
I think that covers everything, we can discuss the ServiceContainer/DependencyInjection comment I made separately as a team at the onset of an upcoming sprint (see issue #1999).
ac5ee79
to
b33180b
Compare
Fixes #1070
This pull request: