-
Notifications
You must be signed in to change notification settings - Fork 281
Missed a couple mocked commands. Bump patch version #334
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
Conversation
| @@ -1,5 +1,5 @@ | |||
| import path = require('path'); | |||
| import fs = require('fs'); | |||
| import * as path from 'path'; | |||
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.
import ... require has slightly different semantics than import ... from. My understanding is that require executes the module as the CommonJS and AMD require function does so that any side effects from the module are applied. import ... from is the normal way to import a module in TypeScript.
node/mock-answer.ts
Outdated
| which?: { [key: string]: string }, | ||
| } | ||
|
|
||
| // TODO TypeScript 2.1: use `keyof` |
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.
What does this mean?
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 believe we're using version 1.8.7 of the TypeScript compiler. TypeScript 2.1 adds a keyof operator: you can just say keyof TaskLibAnswer instead of defining MockedCommand.
node/mock-answer.ts
Outdated
| } | ||
|
|
||
| // TODO TypeScript 2.1: use `keyof` | ||
| export type MockedCommand = "checkPath" |
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.
Double quotes here and single below?
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.
thanks, will fix
| } | ||
|
|
||
| public getResponse(cmd: string, key: string, debug: (message: string) => void): any { | ||
| public getResponse(cmd: MockedCommand, key: string, debug: (message: string) => void): any { |
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.
Breaking change? May want to bump at least the minor since it's mock and not the main code.
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.
Maybe MockCommand?
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.
Yeah, it's technically a breaking change if people are calling getResponse directly for some reason. There aren't any uses right now in vsts-tasks -- it's just used internally in mock-task and mock-toolrunner.
I said MockedCommand since it's "one of the commands that are mocked" and not the mock itself.
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 might be 3rd party extensions using 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.
Yeah, we can bump the minor version
|
LGTM. One last thing: @bryanmacfarlane Can you confirm that bumping minor version is sufficient when making a breaking change? Don't mean to be pedantic but want to make sure we are staying consistent with the versioning for this lib. Especially given what @madhurig helpfully mentioned about 3rd party extensions. |
|
fine. |
* Missed a couple commands. Catch unmocked commands at compile time. Bump patch version * Need to bump again, had un-synced changes upstream * Strings should be single-quoted * Bump minor version * clarify TODO
Forgot to bump the patch version before.
Noticed that I missed a couple of commands that were actually mocked, and so the previous changes were insufficient to stop coercing the
TaskLibAnswertype in our existing code. I defined theMockedCommandtype here so that the compiler will catch all arguments togetResponse.