Skip to content

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

Merged
SimenB merged 1 commit into
jestjs:masterfrom
ahnpnl:watch-plugins-esm
Apr 22, 2021
Merged

SimenB merged 1 commit into
jestjs:masterfrom
ahnpnl:watch-plugins-esm

Conversation

@ahnpnl

@ahnpnl ahnpnl commented Apr 19, 2021

Copy link
Copy Markdown
Contributor

Summary

Related to #11167

Test plan

Adjusted unit test and added e2e tests
Green CI

@codecov-commenter

Copy link
Copy Markdown

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
}
export interface WatchPluginClass {
new (options: {
config: Record<string, unknown>;

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
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 👍

@SimenB SimenB left a comment •

Copy link
Copy Markdown
Member

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

ahnpnl commented Apr 20, 2021

Copy link
Copy Markdown
Contributor Author

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

@SimenB SimenB left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown

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.

4 participants