-
Notifications
You must be signed in to change notification settings - Fork 92
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/sc 123399/delete and disable #698
Feature/sc 123399/delete and disable #698
Conversation
… 'process' for tests
src/cmd/logic-function.test.js
Outdated
@@ -329,21 +340,22 @@ describe('LogicFunctionCommands', () => { | |||
|
|||
const paths = ['dir/', 'dir/path/to/file']; | |||
|
|||
const res = await logicFunctionCommands._validatePaths({ paths }); | |||
const res = await logicFunctionCommands._validatePaths({ dirPath: paths[0], jsonPath: paths[1], _exit: false }); |
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.
Feels too odd to have an _exit
property that is defined as an fn
and here you have it as boolean
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.
@hugomontero can u please elaborate on what feels odd about this?
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.
By default you are telling in the definition that exit
is a function
but over here you are passing exit
as a boolean
so you are breaking with the type definition, in case the code reach that exit
that now is false
it will throw you an error indicating that exit
is not a function
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.
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 is great. thanks for sharing
}); | ||
if (!overwrite) { | ||
this.ui.stdout.write(`Aborted.${os.EOL}`); | ||
process.exit(0); | ||
_exit(); |
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.
In case you need it just for testing (like stub stuff) I think you can do as its mentioned here 👉 https://remarkablemark.org/blog/2017/12/10/sinon-stub-process-exit/
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 promising. I used the _exit()
as Julien suggested is a good alternative as well.
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.
👍
Description
Implements
disable
anddelete
commands for Logic Functions.How to Test
The commands are:
Related Issues / Discussions
https://app.shortcut.com/particle/story/123399/implement-disable-command
https://app.shortcut.com/particle/story/123400/implement-delete-command
Completeness