Skip to content
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

feat(jest-core): add support for watchPlugins written in ESM #11315

Merged
merged 1 commit into from Apr 22, 2021
Merged

feat(jest-core): add support for watchPlugins written in ESM #11315

merged 1 commit into from Apr 22, 2021

Conversation

ahnpnl
Copy link
Contributor

@ahnpnl ahnpnl commented Apr 19, 2021

Summary

Related to #11167

Test plan

Adjusted unit test and added e2e tests
Green CI

@codecov-commenter
Copy link

Codecov Report

Merging #11315 (57c8cb8) into master (1be8d73) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11315      +/-   ##
==========================================
- Coverage   64.19%   64.17%   -0.02%     
==========================================
  Files         308      308              
  Lines       13528    13528              
  Branches     3297     3297              
==========================================
- Hits         8684     8682       -2     
- Misses       4131     4132       +1     
- Partials      713      714       +1     
Impacted Files Coverage Δ
packages/jest-core/src/watch.ts 80.10% <100.00%> (ø)
packages/expect/src/utils.ts 94.83% <0.00%> (-1.30%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1be8d73...57c8cb8. Read the comment docs.

@ahnpnl ahnpnl marked this pull request as ready for review April 19, 2021 21:20
@@ -83,6 +83,7 @@ export interface WatchPlugin {
}
export interface WatchPluginClass {
new (options: {
config: Record<string, unknown>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which config is this? can we type it better?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aha, it's the options provided directly to the plugin, gotcha 👍

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the plugins aren't activate unless you use --watch, are they? Could you make the plugins write something to stdout and assert it's there or something just so we're sure it works?

You can use https://github.com/facebook/jest/blob/53420f8904a80d0e1b52c9a79ae5556dcc6c506b/e2e/runJest.ts#L152

@ahnpnl
Copy link
Contributor Author

ahnpnl commented Apr 20, 2021

the plugins aren't activate unless you use --watch, are they? Could you make the plugins write something to stdout and assert it's there or something just so we're sure it works?

You can use

https://github.com/facebook/jest/blob/53420f8904a80d0e1b52c9a79ae5556dcc6c506b/e2e/runJest.ts#L152

Thanks for the information. I've added a console.log to getUsageInfo which I observe always triggering when watch mode starts

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@SimenB SimenB merged commit 0decd46 into jestjs:master Apr 22, 2021
@ahnpnl ahnpnl deleted the watch-plugins-esm branch April 22, 2021 11:38
@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants