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

fix: matchInlineSnapshot when prettier dependencies are mocked #6776

Merged
merged 1 commit into from
Jul 30, 2018

Conversation

tryggvigy
Copy link
Contributor

Summary

This PR fixes #6702 by seizing to local require prettier in jest-jasmine2. Instead require(config.prettierPath) is used. This prevents the issue where mocking native modules like path and fs that prettier depends on would cause toMatchInlineSnapshot to fail.

Test plan

Run the new unit test introduced in this PR.

@tryggvigy tryggvigy force-pushed the remove-local-require-prettier branch from ba542f4 to 161da2e Compare July 29, 2018 22:25
@tryggvigy tryggvigy changed the title Regular require prettier instead of local require in jest-jasmine2 Fix matchInlineSnapshot when prettier dependencies mocked Jul 29, 2018
@tryggvigy tryggvigy changed the title Fix matchInlineSnapshot when prettier dependencies mocked Make matchInlineSnapshot work when prettier dependencies are mocked Jul 29, 2018
@codecov-io
Copy link

codecov-io commented Jul 29, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@0f525c5). Click here to learn what that means.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #6776   +/-   ##
=========================================
  Coverage          ?   63.68%           
=========================================
  Files             ?      235           
  Lines             ?     9007           
  Branches          ?        4           
=========================================
  Hits              ?     5736           
  Misses            ?     3270           
  Partials          ?        1
Impacted Files Coverage Δ
packages/jest-jasmine2/src/setup_jest_globals.js 0% <0%> (ø)

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 0f525c5...161da2e. Read the comment docs.

@tryggvigy tryggvigy changed the title Make matchInlineSnapshot work when prettier dependencies are mocked fix: matchInlineSnapshot when prettier dependencies are mocked Jul 29, 2018
@thymikee thymikee merged commit fb2a6ac into jestjs:master Jul 30, 2018
@tryggvigy tryggvigy deleted the remove-local-require-prettier branch July 31, 2018 08:32
thymikee added a commit to rhysawilliams2010/jest that referenced this pull request Aug 8, 2018
* upstream/master: (122 commits)
  fix: don't report promises as open handles (jestjs#6716)
  support serializing `DocumentFragment` (jestjs#6705)
  Allow test titles to include array index (jestjs#6414)
  fix `toContain` suggest to contain equal message (jestjs#6810)
  fix: testMatch not working with negations (jestjs#6648)
  Add test cases for jestjs#6744 (jestjs#6772)
  print stack trace on calls to process.exit (jestjs#6714)
  Updates SnapshotTesting.md to provide more info. on snapshot scope (jestjs#6735)
  Mark snapshots as obsolete when moved to an inline snapshot (jestjs#6773)
  [Docs] Clarified the use of literal values as property matchers in toMatchSnapshot() (jestjs#6807)
  Update CHANGELOG.md (jestjs#6799)
  fix changelog entry that is not in 23.4.2 (jestjs#6796)
  Fix --coverage with --findRelatedTests overwriting collectCoverageFrom options (jestjs#6736)
  Update testURL default value from about:blank to localhost (jestjs#6792)
  fix: `matchInlineSnapshot` when prettier dependencies are mocked (jestjs#6776)
  Fix retryTimes and add e2e regression test (jestjs#6762)
  Release v23.4.2
  Docs/ExpectAPI: Correct docs for `objectContaining` (jestjs#6754)
  chore(packages/babel-jest) readme (jestjs#6746)
  docs: noted --coverage aliased by --collectCoverage (jestjs#6741)
  ...
@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.

toMatchInlineSnapshot fails if prettier's native module deps are mocked through jest.mock
5 participants