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

Make lastCommit and changedFilesWithAncestor work through config #5476

Merged
merged 1 commit into from
Feb 7, 2018
Merged

Make lastCommit and changedFilesWithAncestor work through config #5476

merged 1 commit into from
Feb 7, 2018

Conversation

mjesun
Copy link
Contributor

@mjesun mjesun commented Feb 6, 2018

This change makes changedFilesWithAncestor and lastCommit work both via configuration and via CLI. Before that, they could only be used in CLI, and adding them to the configuration (either package.json or a separate JSON file) will cause them either to be ignored or complain as an invalid parameter. This required to move as well some of the logic deeper into configuration normalization.

On the other side, I also improved the ancestor logic for Mercurial. Instead of just using the last commit, it will try to find the root of the branch. The reason for the change is that it is extremely confusing to see tests getting/not-getting executed when your branch has a bunch of stacked commits.

@@ -38,12 +38,6 @@ describe('check', () => {
);
});

it('sets onlyChanged if lastCommit is specified', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test case is removed because it does not apply anymore; the logic has been moved to normalize in jest-config. Which, in turn, it's the right place to have it (argv should be read-only).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice!

@@ -571,6 +571,16 @@ export default function normalize(options: InitialOptions, argv: Argv) {
);
}

for (const key of [
Copy link
Collaborator

Choose a reason for hiding this comment

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

@thymikee
Copy link
Collaborator

thymikee commented Feb 6, 2018

I really like this change 👍

@codecov-io
Copy link

Codecov Report

Merging #5476 into master will increase coverage by 0.8%.
The diff coverage is 60%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #5476     +/-   ##
=========================================
+ Coverage   61.42%   62.23%   +0.8%     
=========================================
  Files         213      205      -8     
  Lines        7057     6935    -122     
  Branches        3        4      +1     
=========================================
- Hits         4335     4316     -19     
+ Misses       2721     2618    -103     
  Partials        1        1
Impacted Files Coverage Δ
packages/jest-config/src/valid_config.js 100% <ø> (ø) ⬆️
packages/jest-config/src/defaults.js 100% <ø> (ø) ⬆️
packages/jest-changed-files/src/hg.js 30.3% <50%> (+2.17%) ⬆️
packages/jest-config/src/normalize.js 92.13% <66.66%> (-0.97%) ⬇️
packages/jest-cli/src/watch.js 70.62% <0%> (-2.91%) ⬇️
packages/jest-cli/src/jest_hooks.js
...ackages/jest-cli/src/lib/active_filters_message.js
packages/jest-cli/src/plugins/test_name_pattern.js
...st-cli/src/plugins/update_snapshots_interactive.js
packages/jest-cli/src/plugins/test_path_pattern.js
... and 10 more

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 faf8883...64485f7. Read the comment docs.

@mjesun
Copy link
Contributor Author

mjesun commented Feb 6, 2018

It'd be nice to get a +1 on that one 🙃

@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 12, 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.

6 participants