This repository has been archived by the owner on Aug 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
feat: add postrun hook #111
Merged
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a20e75a
post run hook
colbymatthiassonpublic fad9b84
tested post run hook
colbymatthiassonpublic 14e712f
removed package-lock.json
colbymatthiassonpublic 62f4b81
Added postrun hook test for command failing
moberhauer b81c10a
capturing command result in posthook
colbymatthiassonpublic 0daccf2
Added a test for post-run hook capturing the result of command
moberhauer 439b7fe
removed useless hooktest script
moberhauer b4fa328
Update src/hooks.ts
colbymatthiassonpublic 11528c7
Added newlines for readability
moberhauer 7cc5713
Merge branch 'master' of https://github.com/colbymatthiassonpublic/co…
moberhauer 9e87536
Fixed semicolon
moberhauer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function postrun() { | ||
console.log('running ts postrun hook') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,14 +17,12 @@ describe('typescript', () => { | |
commandsDir: p('src/commands'), | ||
}) | ||
}) | ||
|
||
withConfig | ||
RasPhilCo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.stdout() | ||
.it('runs ts command and prerun hooks', async ctx => { | ||
.it('runs ts command and prerun and postrun hooks', async ctx => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might as well have this as a separate test. Also, what about if the command errors? Add a test for that. I'm assuming the hook won't fire. Is that the right behavior? |
||
await ctx.config.runCommand('foo:bar:baz') | ||
expect(ctx.stdout).to.equal('running ts prerun hook\nit works!\n') | ||
expect(ctx.stdout).to.equal('running ts prerun hook\nit works!\nrunning ts postrun hook\n') | ||
}) | ||
|
||
withConfig | ||
RasPhilCo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.stdout() | ||
.it('runs init hook', async ctx => { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We should capture the results of the command and pass that into the post run hook. I would imagine a lot of post hooks would want to try and do something with the command results.