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

Check if npm_lifecycle_script calls jest directly #4629

Merged
merged 2 commits into from
Oct 8, 2017

Conversation

adityavohra7
Copy link

Summary
Fixes #4440. Check if npm_lifecycle_script calls jest directly because it's possible that projects wrap the invocation of jest with some script. If jest is called directly, the snapshot update command is something like yarn test -u (note: the -- has been removed). Else suggest people "re-run jest with -u".

I yarn link'ed jest-cli to my-app which has this package.json:

➜  my-app cat package.json
{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.0.0",
    "react-dom": "^16.0.0"
  },
  "scripts": {
    "test-call-jest-indirectly": "./run-tests.sh",
    "test-call-jest-directly": "jest"
  },
  "devDependencies": {
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "jest": "^21.2.1",
    "react-test-renderer": "^16.0.0"
  }
}

where run-tests.sh is:

#!/usr/bin/env bash
jest

Running yarn test-call-jest-directly with failing snapshot tests yields:

...
 › 1 snapshot test failed in 1 test suite. Inspect your code changes or run `yarn run test-call-jest-directly -u` to update them.
...

Running yarn test-call-jest-indirectly with failing snapshot tests yields:

...
 › 1 snapshot test failed in 1 test suite. Inspect your code changes or re-run jest with `-u` to update them.
...

@codecov-io
Copy link

codecov-io commented Oct 8, 2017

Codecov Report

Merging #4629 into master will decrease coverage by 0.2%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4629      +/-   ##
==========================================
- Coverage   56.36%   56.15%   -0.21%     
==========================================
  Files         194      194              
  Lines        6559     6553       -6     
  Branches        3        3              
==========================================
- Hits         3697     3680      -17     
- Misses       2861     2872      +11     
  Partials        1        1
Impacted Files Coverage Δ
...ackages/jest-cli/src/reporters/summary_reporter.js 8.33% <0%> (-0.15%) ⬇️
packages/jest-environment-jsdom/src/index.js 0% <0%> (-44.45%) ⬇️
packages/jest-util/src/fake_timers.js 90.95% <0%> (-0.1%) ⬇️
packages/jest-environment-node/src/index.js 63.15% <0%> (+0.65%) ⬆️

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 66329e8...8af10e2. Read the comment docs.

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

Can Jest use npm_lifecycle_script to determine the update command?
4 participants