-
Notifications
You must be signed in to change notification settings - Fork 36
Conversation
Thanks for the contribution! It looks like @colbymatthiassonpublic is an internal user so signing the CLA is not required. However, we need to confirm this. |
Codecov Report
@@ Coverage Diff @@
## master #111 +/- ##
======================================
Coverage 0.00% 0.00%
======================================
Files 2 2
Lines 12 12
Branches 3 3
======================================
Misses 12 12 Continue to review full report at Codecov.
|
src/config.ts
Outdated
@@ -355,6 +355,7 @@ export class Config implements IConfig { | |||
const command = c.load() | |||
await this.runHook('prerun', {Command: command, argv}) | |||
await command.run(argv, this) | |||
await this.runHook('postrun', {Command: command, argv}) |
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.
test/typescript.test.ts
Outdated
withConfig | ||
.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 comment
The 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?
Thanks for the contribution! It looks like @colbymatthiassonpublic @moberhauer is an internal user so signing the CLA is not required. However, we need to confirm 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.
Just one comment otherwise looks great.
.stdout() | ||
.it('runs ts command, postrun hook captures command result', async ctx => { | ||
await ctx.config.runCommand('foo:bar:test-result') | ||
expect(ctx.stdout).to.equal('running ts prerun hook\nit works!\nrunning ts postrun hook\nreturned success!\n') |
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.
👍
package.json
Outdated
@@ -50,6 +50,7 @@ | |||
"posttest": "yarn lint", | |||
"prepack": "yarn run build", | |||
"test": "mocha --forbid-only \"test/**/*.test.ts\"", | |||
"hooktest": "mocha --forbid-only \"test/typescript.test.ts\"", |
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 don't love this. The typescript.test.ts
has a test other than hooks too. And if you need to run one file, just run mocha directly. Let's remove 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.
Tested this out locally. 👍 🚢
Co-authored-by: RasPhilCo <[email protected]>
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.
Great PR! Few readability edits.
test/typescript.test.ts
Outdated
withConfig | ||
.stdout() | ||
.it('runs ts command and prerun hooks', async ctx => { | ||
.it('runs ts command, prerun and postrun hooks both trigger', async ctx => { |
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.
how about? 'runs ts command and prerun & postrun hooks'
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.
🏄
@colbymatthiassonpublic @moberhauer click the CLA link to get this status check approved
|
added post run hook capability