-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Small polish to the plugins API #5572
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5572 +/- ##
==========================================
- Coverage 61.72% 61.71% -0.02%
==========================================
Files 213 213
Lines 7169 7169
Branches 4 3 -1
==========================================
- Hits 4425 4424 -1
- Misses 2743 2744 +1
Partials 1 1
Continue to review full report at Codecov.
|
Awesome stuff @rogeliog
I'm on board with this API and wanted to leave a few notes to consider: I like that Also, it may just be me but
Agree this is awkward -- the internal reporters work the same way by extending BaseReporter. Would be good to clean both up |
packages/jest-cli/src/watch.js
Outdated
@@ -51,13 +51,13 @@ const getSortedUsageRows = ( | |||
) => { | |||
const internalPlugins = watchPlugins | |||
.slice(0, INTERNAL_PLUGINS.length) | |||
.map(p => p.getUsageRow(globalConfig)) | |||
.filter(usage => !usage.hide); | |||
.map(p => p.getUsageData && p.getUsageData(globalConfig)) |
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.
Like the added check here
globalConfig: GlobalConfig, | ||
updateConfigAndRun: Function, | ||
): Promise<boolean> { | ||
updateConfigAndRun({updateSnapshot: 'all'}); | ||
return Promise.resolve(false); | ||
} | ||
|
||
registerHooks(hooks: JestHookSubscriber) { | ||
apply(hooks: JestHookSubscriber) { | ||
this._hasSnapshotFailure = true; |
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.
Is this necessary/intentional or a leftover from debugging?
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.
Nice catch
packages/jest-cli/src/watch.js
Outdated
const usageRow = plugin.getUsageRow(globalConfig) || {}; | ||
|
||
return usageRow.key === parseInt(key, 16); | ||
const UsageData = |
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.
nit - should this be camelCase?
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 great
Awesome! |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
This is one of the items of #5478
This is the proposed API, feedback is MORE than welcome
showPrompt
->run
->runInteractive
just because I felt it was a bit more explicit, thoughts?BaseWatchPlugin
, I find this a bit awkward. It would be nice to get rid of it. We currently injectstdin
andstdout
in the constructor(this is for handling stuff like--useStderr
). What would be another good way of injecting this?Test plan