-
Notifications
You must be signed in to change notification settings - Fork 0
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/browser result parser #38
Conversation
Generated by 🚫 dangerJS |
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.
https://github.com/smartprocure/duti/blob/feature/browser-result-parser/package.json#L21
Can you change that since there's now configuration in package.json
for this?
src/duties/browserResults.js
Outdated
|
||
if (result && summary) { | ||
let { error, failed, exitCode } = summary | ||
if (false === error && 0 === failed && 0 === exitCode) { |
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.
swap these logic tests around please
eg error === false
, failed === 0
, etc
src/duties/browserResults.js
Outdated
if (result && summary) { | ||
let { error, failed, exitCode } = summary | ||
if (false === error && 0 === failed && 0 === exitCode) { | ||
message('Your PR has no browser errors. Great job!') |
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.
Please just use one space after periods
src/duties/browserResults.js
Outdated
}, failedTests), | ||
// Filter by failed tests. | ||
_.filter(testResult => { | ||
return false === testResult.success |
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.
Swap logic test here, too
src/duties/browserResults.js
Outdated
_.mapValues(r => r), | ||
// Flatten test results into one array. | ||
_.reduce((flattened, other) => { | ||
return flattened.concat(other) |
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.
you can do (flattened, other) => flattened.concat(other)
, or even better, (flattened, other) => [...flattened, other]
src/duties/browserResults.js
Outdated
} | ||
|
||
if (failed > 0) { | ||
let failedTests = [] |
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 there a reason why it's starts as an empty array?
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.
That's what wanted to know as well. Better solution?
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.
From what I understand _.reduce
requires the accumulator
as the initial value. I do agree with you, it definitely could be improved.
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 it possible to inline it?
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.
Just did.
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 way better now. It would be perfect if we don't have to have that at all ;)
src/duties/browserResults.js
Outdated
} | ||
|
||
// All other cases: error is not false, exitCode is not 0 etc. | ||
fail('Browser test error. Please see CI logs for more details.') |
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.
One too many spaces after period
src/duties/browserResults.js
Outdated
fail('Browser test error. Please see CI logs for more details.') | ||
} else { | ||
message( | ||
'Incorrect browser result format. Please see CI logs for more details.' |
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.
One too many spaces after period
src/duties/browserResults.js
Outdated
_.flow( | ||
// Flatten test results into one array. | ||
_.reduce((flattened, other) => { | ||
return flattened.concat(other) |
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.
just return directly after the arrow function. You should probably also concat using spreads eg:
(flattened, other) => [...flattened, other]
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.
Tried this _.reduce((flattened, other) => [...flattened, other], []),
but doesn't work. I should probably change the spec to match the output text.
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.
Btw, what you want me to do with the package.json?
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.
"lint": "eslint . --ignore-path .gitignore",
?
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.
ah, that's fine then. _.reduce((flattened, other) => flattened.concat(other), [])
should do the trick. Just trying to avoid the unnecessary return
there 👍
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.
also, in package.json, I inlined the options --singleQuote
etc in the fmt script, but since we're breaking configuration out, we should remove it in the fmt
script
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.
"fmt": "prettier --write {*.js,{src,bin}/**/*.js} --no-semi --single-quote --trailing-comma es5"
turns to
"fmt": "prettier --write {*.js,{src,bin}/**/*.js}"
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.
That looks way better.
We have that in package.json now.
🎉 |
@daedalus28 look good? |
package.json
Outdated
@@ -4,8 +4,12 @@ | |||
"bin": { | |||
"duti": "bin/duti" | |||
}, | |||
"version": "0.7.1", | |||
"version": "0.7.2", |
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.
this should probably be 0.8.0 because it is a new feature :)
src/duties/browserResults.js
Outdated
if (failed > 0) { | ||
_.flow( | ||
// Flatten test results into one array. | ||
_.reduce((flattened, other) => flattened.concat(other), []), |
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.
since result in an object, you can just do a _.values
and then a _.flatten
in the flow
src/duties/autoFix.js
Outdated
let { execSync } = require('child_process') | ||
let { Repository } = Git | ||
let { getRunningDirectory } = require('../utils') | ||
let _ = require("lodash/fp"); |
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.
why are there double quotes and semicolons here? looks like the prettier config messed up
This PR is for #37. Changes including: