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

Added informative error format #143

Conversation

RobertReaves
Copy link
Collaborator

Short description of the work completed

Steps to test (if not obvious)

For Reviewer Use Only

  • Code Reviewed
  • Tests Passed
  • Coverage Reviewed
  • Feature worked as expected
  • Updated src/help.js and README.md
  • Is the version upgrade path clear for this change? (breaking vs minor vs
    patch)
  • Follow up work tracked in a card if needed

@@ -12,6 +12,9 @@ commander.parse(process.argv);
let options = {};
const { verbose, maxbuffer, args } = commander;
const prerelease = args.length ? args[0] : true;
options = extend({}, { prerelease, verbose, maxbuffer, workflow });
options = extend(
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think the extend is needed here. You should just be able to do something like...

options = { prerelease, verbose, maxbuffer, workflow, command: "prerelease" };

@@ -12,6 +12,9 @@ commander.parse(process.argv);
let options = {};
const { verbose, maxbuffer, args } = commander;
const promote = args.length ? args[0] : true;
options = extend({}, { promote, verbose, maxbuffer, workflow });
options = extend(
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

};

let options = {};
const { verbose, maxbuffer, args } = commander;
const qa = args.length ? args[0] : true;
options = extend({}, { qa, verbose, maxbuffer, callback, workflow });
options = extend(
{},
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

@@ -6,6 +6,6 @@ const workflow = require("../src/workflows/reset");

commander.parse(process.argv);

const options = extend({}, { reset: true, workflow });
const options = extend({}, { reset: true, workflow, command: "reset" });
Copy link
Contributor

Choose a reason for hiding this comment

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

And here...

@@ -10,6 +10,6 @@ utils.applyCommanderOptions(commander);
commander.parse(process.argv);

const { verbose, maxbuffer } = commander;
const options = extend({}, { verbose, maxbuffer, workflow });
const options = extend({}, { verbose, maxbuffer, workflow, command: "start" });
Copy link
Contributor

Choose a reason for hiding this comment

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

And here...

state = {};
});

afterEach(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can remove the afterEach here since the beforeEach will run before each test. You should have a fresh start each time

@@ -73,7 +73,9 @@ describe("shared workflow steps", () => {
});

afterEach(() => {
state = {};
state = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you move this code into the beforeEach and remove this afterEach?

command: ${options.command}
step: ${options.step}
error: ${error.message}`;
utils.writeFile(logPath, content);
Copy link
Contributor

Choose a reason for hiding this comment

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

This could just be...

const fs = require("fs");
fs.appendFileSync(logPath, content);

Then you could remove lines 9-12. At some point in the future maybe you could pull that out to a utils.appendFile method, but for now I'm find if you just use fs directly since the API is the same. It could be refactored in a following PR and update the other places you mentioned that could benefit for appendFile instead of writing the whole thing again

@@ -88,6 +88,7 @@ const api = {
},
fetchUpstream(state) {
state.step = "fetchUpstream";
// return Promise.reject(new Error("something bad"));
Copy link
Contributor

Choose a reason for hiding this comment

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

delete please

Copy link
Contributor

@elijahmanor elijahmanor left a comment

Choose a reason for hiding this comment

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

I approve this

@elijahmanor elijahmanor merged commit 592612a into LeanKit-Labs:feature-some-cleanup Sep 14, 2018
@RobertReaves RobertReaves deleted the feature-beautiful-errors branch April 5, 2019 18:45
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