-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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(mock): consider modules as objects #13513
Conversation
Sentry JS SDK maintainer here. Yup, I can confirm that when I roll back to a commit which doesn't add the Good detective work, @Tofandel! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
could you add a unit test and a changelog entry?
Hi @Tofandel! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
@SimenB Done 👍 |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
…'` to CJS files (#6043) As of version 2.69.0, setting `output.generatedCode` to `'es2015'` (as we do) causes Rollup to [add `[Symbol.toStringTag]: 'Module'` to generated CJS files](rollup/rollup#4378 (comment)). Though this is valid ES6, it causes Jest to be unable to mock our generated packages. Though [a PR](jestjs/jest#13513) has been opened to fix this, the change almost certainly won't be backported, so anyone using Jest 29.2.2 or under will run into [this problem](#5994) if they try to mock `@sentry/xxx` 7.16. (The relevant change was introduced in #5951, when we (semi-)accidentally upgraded Rollup from 2.67.1 to 2.78.0, and was first included in version 7.16.) This PR prevents the new Rollup behavior, since it has no known benefit. (The [Rollup docs](https://rollupjs.org/guide/en/#outputgeneratedcode) say that presence of the `'Module'` toStringTag "is used for feature detection in certain libraries and frameworks," but not having it hasn't seemed to hurt us so far.)
<h3>Snyk has created this PR to upgrade multiple dependencies.</h3> 👯 The following dependencies are linked and will therefore be updated together. </br></br> :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project. </br></br> Name | Versions | Released on :-------------|:-------------|:------------- **babel-jest**</br>from 29.1.2 to 29.3.1 | **5 versions** ahead of your current version | **22 days ago**</br>on 2022-11-08 **jest**</br>from 29.1.2 to 29.3.1 | **5 versions** ahead of your current version | **22 days ago**</br>on 2022-11-08 <details> <summary><b>Release notes</b></summary> <br/> <details> <summary>Package name: <b>babel-jest</b></summary> <ul> <li> <b>29.3.1</b> - <a href="https://snyk.io/redirect/github/facebook/jest/releases/tag/v29.3.1">2022-11-08</a></br><h2>Fixes</h2> <ul> <li><code>[jest-config]</code> Do not warn about <code>preset</code> in <code>ProjectConfig</code> <a href="https://snyk.io/redirect/github/facebook/jest/pull/13583" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13583/hovercard">#13583</a></li> </ul> <h2>Performance</h2> <ul> <li><code>[jest-transform]</code> Defer creation of cache directory <a href="https://snyk.io/redirect/github/facebook/jest/pull/13420" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13420/hovercard">#13420</a></li> </ul> </li> <li> <b>29.3.0</b> - <a href="https://snyk.io/redirect/github/facebook/jest/releases/tag/v29.3.0">2022-11-07</a></br><h2>Features</h2> <ul> <li><code>[jest-runtime]</code> Support WebAssembly (Wasm) imports in ESM modules (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13505" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13505/hovercard">#13505</a>)</li> </ul> <h2>Fixes</h2> <ul> <li><code>[jest-config]</code> Add config validation for <code>projects</code> option (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13565" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13565/hovercard">#13565</a>)</li> <li><code>[jest-mock]</code> Treat cjs modules as objects so they can be mocked (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13513" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13513/hovercard">#13513</a>)</li> <li><code>[jest-worker]</code> Throw an error instead of hanging when jest workers terminate unexpectedly (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13566" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13566/hovercard">#13566</a>)</li> </ul> <h2>Chore & Maintenance</h2> <ul> <li><code>[@ jest/transform]</code> Update <code>convert-source-map</code> (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13509" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13509/hovercard">#13509</a>)</li> <li><code>[docs]</code> Mention <code>toStrictEqual</code> in UsingMatchers docs. (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13560" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13560/hovercard">#13560</a>)</li> </ul> <h2>New Contributors</h2> <ul> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/Tofandel/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/Tofandel">@ Tofandel</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1422777152" data-permission-text="Title is private" data-url="jestjs/jest#13513" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13513/hovercard" href="https://snyk.io/redirect/github/facebook/jest/pull/13513">#13513</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/RyWilliams/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/RyWilliams">@ RyWilliams</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1424372609" data-permission-text="Title is private" data-url="jestjs/jest#13520" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13520/hovercard" href="https://snyk.io/redirect/github/facebook/jest/pull/13520">#13520</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/waikoo/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/waikoo">@ waikoo</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1410500473" data-permission-text="Title is private" data-url="jestjs/jest#13447" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13447/hovercard" href="https://snyk.io/redirect/github/facebook/jest/pull/13447">#13447</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/kachkaev/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/kachkaev">@ kachkaev</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1421615843" data-permission-text="Title is private" data-url="jestjs/jest#13505" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13505/hovercard" href="https://snyk.io/redirect/github/facebook/jest/pull/13505">#13505</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/ibuibu/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/ibuibu">@ ibuibu</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1437401469" data-permission-text="Title is private" data-url="jestjs/jest#13565" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13565/hovercard" href="https://snyk.io/redirect/github/facebook/jest/pull/13565">#13565</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/necipallef/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/necipallef">@ necipallef</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1436721950" data-permission-text="Title is private" data-url="jestjs/jest#13560" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13560/hovercard" href="https://snyk.io/redirect/github/facebook/jest/pull/13560">#13560</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/ravshansbox/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/ravshansbox">@ ravshansbox</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1428561971" data-permission-text="Title is private" data-url="jestjs/jest#13533" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13533/hovercard" href="https://snyk.io/redirect/github/facebook/jest/pull/13533">#13533</a></li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https://snyk.io/redirect/github/facebook/jest/compare/v29.2.2...v29.3.0"><tt>v29.2.2...v29.3.0</tt></a></p> </li> <li> <b>29.2.2</b> - <a href="https://snyk.io/redirect/github/facebook/jest/releases/tag/v29.2.2">2022-10-24</a></br><h2>Fixes</h2> <ul> <li><code>[@ jest/test-sequencer]</code> Make sure sharding does not produce empty groups (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13476" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13476/hovercard">#13476</a>)</li> <li><code>[jest-circus]</code> Test marked as <code>todo</code> are shown as todo when inside a focussed describe (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13504" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13504/hovercard">#13504</a>)</li> <li><code>[jest-mock]</code> Ensure mock resolved and rejected values are promises from correct realm (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13503" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13503/hovercard">#13503</a>)</li> <li><code>[jest-snapshot]</code> Don't highlight passing asymmetric property matchers in snapshot diff (<a href="https://snyk.io/redirect/github/facebook/jest/issues/13480" data-hovercard-type="issue" data-hovercard-url="/jestjs/jest/issues/13480/hovercard">#13480</a>)</li> </ul> <h2>Chore & Maintenance</h2> <ul> <li><code>[docs]</code> Update link to Jest 28 upgrade guide in error message (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13483" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13483/hovercard">#13483</a>)</li> <li><code>[jest-runner, jest-watcher]</code> Update <code>emittery</code> (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13490" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13490/hovercard">#13490</a>)</li> </ul> <h2>New Contributors</h2> <ul> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/moonrailgun/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/moonrailgun">@ moonrailgun</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1418595732" data-permission-text="Title is private" data-url="jestjs/jest#13483" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13483/hovercard" href="https://snyk.io/redirect/github/facebook/jest/pull/13483">#13483</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/halldorbjarni/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/halldorbjarni">@ halldorbjarni</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1418768753" data-permission-text="Title is private" data-url="jestjs/jest#13491" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13491/hovercard" href="https://snyk.io/redirect/github/facebook/jest/pull/13491">#13491</a></li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https://snyk.io/redirect/github/facebook/jest/compare/v29.2.1...v29.2.2"><tt>v29.2.1...v29.2.2</tt></a></p> </li> <li> <b>29.2.1</b> - <a href="https://snyk.io/redirect/github/facebook/jest/releases/tag/v29.2.1">2022-10-18</a></br><h2>Features</h2> <ul> <li><code>[@ jest/globals, jest-mock]</code> Add <code>jest.Spied*</code> utility types (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13440" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13440/hovercard">#13440</a>)</li> </ul> <h2>Fixes</h2> <ul> <li><code>[jest-environment-node]</code> make <code>globalThis.performance</code> writable for Node 19 and fake timers (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13467" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13467/hovercard">#13467</a>)</li> <li><code>[jest-mock]</code> Revert <a href="https://snyk.io/redirect/github/facebook/jest/pull/13398" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13398/hovercard">#13398</a> to restore mocking of setters (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13472" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13472/hovercard">#13472</a>)</li> </ul> <h2>Performance</h2> <ul> <li><code>[*]</code> Use sha1 instead of sha256 for hashing (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13421" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13421/hovercard">#13421</a>)</li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https://snyk.io/redirect/github/facebook/jest/compare/v29.2.0...v29.2.1"><tt>v29.2.0...v29.2.1</tt></a></p> </li> <li> <b>29.2.0</b> - <a href="https://snyk.io/redirect/github/facebook/jest/releases/tag/v29.2.0">2022-10-14</a></br><h2>Features</h2> <ul> <li><code>[@ jest/cli, jest-config]</code> A seed for the test run will be randomly generated, or set by a CLI option (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13400" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13400/hovercard">#13400</a>)</li> <li><code>[@ jest/cli, jest-config]</code> <code>--show-seed</code> will display the seed value in the report, and can be set via a CLI flag or through the config file (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13400" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13400/hovercard">#13400</a>)</li> <li><code>[jest-config]</code> Add <code>readInitialConfig</code> utility function (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13356" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13356/hovercard">#13356</a>)</li> <li><code>[jest-core]</code> Allow <code>testResultsProcessor</code> to be async (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13343" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13343/hovercard">#13343</a>)</li> <li><code>[@ jest/environment, jest-environment-node, jest-environment-jsdom, jest-runtime]</code> Add <code>getSeed()</code> to the <code>jest</code> object (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13400" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13400/hovercard">#13400</a>)</li> <li><code>[expect, @ jest/expect-utils]</code> Allow <code>isA</code> utility to take a type argument (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13355" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13355/hovercard">#13355</a>)</li> <li><code>[expect]</code> Expose <code>AsyncExpectationResult</code> and <code>SyncExpectationResult</code> types (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13411" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13411/hovercard">#13411</a>)</li> </ul> <h2>Fixes</h2> <ul> <li><code>[babel-plugin-jest-hoist]</code> Ignore <code>TSTypeQuery</code> when checking for hoisted references (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13367" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13367/hovercard">#13367</a>)</li> <li><code>[jest-core]</code> Fix <code>detectOpenHandles</code> false positives for some special objects such as <code>TLSWRAP</code> (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13414" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13414/hovercard">#13414</a>)</li> <li><code>[jest-mock]</code> Fix mocking of getters and setters on classes (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13398" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13398/hovercard">#13398</a>)</li> <li><code>[jest-reporters]</code> Revert: Transform file paths into hyperlinks (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13399" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13399/hovercard">#13399</a>)</li> <li><code>[@ jest/types]</code> Infer type of <code>each</code> table correctly when the table is a tuple or array (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13381" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13381/hovercard">#13381</a>)</li> <li><code>[@ jest/types]</code> Rework typings to allow the <code>*ReturnedWith</code> matchers to be called with no argument (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13385" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13385/hovercard">#13385</a>)</li> </ul> <h2>Chore & Maintenance</h2> <ul> <li><code>[*]</code> Update <code>@ babel/*</code> deps, resulting in slightly different stack traces for <code>each</code> (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13422" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13422/hovercard">#13422</a>)</li> </ul> <h2>Performance</h2> <ul> <li><code>[jest-runner]</code> Do not instrument v8 coverage data if coverage should not be collected (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13282" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13282/hovercard">#13282</a>)</li> </ul> <h2>New Contributors</h2> <ul> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/johannessjoberg/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/johannessjoberg">@ johannessjoberg</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1392370848" data-permission-text="Title is private" data-url="jestjs/jest#13343" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13343/hovercard" href="https://snyk.io/redirect/github/facebook/jest/pull/13343">#13343</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/mitchhentgesspotify/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/mitchhentgesspotify">@ mitchhentgesspotify</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1378178654" data-permission-text="Title is private" data-url="jestjs/jest#13282" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13282/hovercard" href="https://snyk.io/redirect/github/facebook/jest/pull/13282">#13282</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/Methuselah96/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/Methuselah96">@ Methuselah96</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1401960828" data-permission-text="Title is private" data-url="jestjs/jest#13409" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13409/hovercard" href="https://snyk.io/redirect/github/facebook/jest/pull/13409">#13409</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jhwang98/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/jhwang98">@ jhwang98</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1401011982" data-permission-text="Title is private" data-url="jestjs/jest#13400" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13400/hovercard" href="https://snyk.io/redirect/github/facebook/jest/pull/13400">#13400</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/professorjrod/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/professorjrod">@ professorjrod</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1402520759" data-permission-text="Title is private" data-url="jestjs/jest#13418" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13418/hovercard" href="https://snyk.io/redirect/github/facebook/jest/pull/13418">#13418</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jesusarell/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/jesusarell">@ jesusarell</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1401930513" data-permission-text="Title is private" data-url="jestjs/jest#13407" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13407/hovercard" href="https://snyk.io/redirect/github/facebook/jest/pull/13407">#13407</a></li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https://snyk.io/redirect/github/facebook/jest/compare/v29.1.2...v29.2.0"><tt>v29.1.2...v29.2.0</tt></a></p> </li> <li> <b>29.1.2</b> - <a href="https://snyk.io/redirect/github/facebook/jest/releases/tag/v29.1.2">2022-09-30</a></br><h2>Fixes</h2> <ul> <li><code>[expect, @ jest/expect]</code> Revert buggy inference of argument types for <code>*CalledWith</code> and <code>*ReturnedWith</code> matchers introduced in 29.1.0 (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13339" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13339/hovercard">#13339</a>)</li> <li><code>[jest-worker]</code> Add missing dependency on <code>jest-util</code> (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13341" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13341/hovercard">#13341</a>)</li> </ul> <h2>New Contributors</h2> <ul> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/brunocabral88/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/brunocabral88">@ brunocabral88</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1388869458" data-permission-text="Title is private" data-url="jestjs/jest#13329" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13329/hovercard" href="https://snyk.io/redirect/github/facebook/jest/pull/13329">#13329</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/alexander-akait/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/alexander-akait">@ alexander-akait</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1391618696" data-permission-text="Title is private" data-url="jestjs/jest#13341" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13341/hovercard" href="https://snyk.io/redirect/github/facebook/jest/pull/13341">#13341</a></li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https://snyk.io/redirect/github/facebook/jest/compare/v29.1.1...v29.1.2"><tt>v29.1.1...v29.1.2</tt></a></p> </li> </ul> from <a href="https://snyk.io/redirect/github/facebook/jest/releases">babel-jest GitHub release notes</a> </details> <details> <summary>Package name: <b>jest</b></summary> <ul> <li> <b>29.3.1</b> - <a href="https://snyk.io/redirect/github/facebook/jest/releases/tag/v29.3.1">2022-11-08</a></br><h2>Fixes</h2> <ul> <li><code>[jest-config]</code> Do not warn about <code>preset</code> in <code>ProjectConfig</code> <a href="https://snyk.io/redirect/github/facebook/jest/pull/13583" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13583/hovercard">#13583</a></li> </ul> <h2>Performance</h2> <ul> <li><code>[jest-transform]</code> Defer creation of cache directory <a href="https://snyk.io/redirect/github/facebook/jest/pull/13420" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13420/hovercard">#13420</a></li> </ul> </li> <li> <b>29.3.0</b> - <a href="https://snyk.io/redirect/github/facebook/jest/releases/tag/v29.3.0">2022-11-07</a></br><a href="https://snyk.io/redirect/github/facebook/jest/releases/tag/v29.3.0"> Read more </a> </li> <li> <b>29.2.2</b> - <a href="https://snyk.io/redirect/github/facebook/jest/releases/tag/v29.2.2">2022-10-24</a></br><a href="https://snyk.io/redirect/github/facebook/jest/releases/tag/v29.2.2"> Read more </a> </li> <li> <b>29.2.1</b> - <a href="https://snyk.io/redirect/github/facebook/jest/releases/tag/v29.2.1">2022-10-18</a></br><h2>Features</h2> <ul> <li><code>[@ jest/globals, jest-mock]</code> Add <code>jest.Spied*</code> utility types (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13440" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13440/hovercard">#13440</a>)</li> </ul> <h2>Fixes</h2> <ul> <li><code>[jest-environment-node]</code> make <code>globalThis.performance</code> writable for Node 19 and fake timers (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13467" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13467/hovercard">#13467</a>)</li> <li><code>[jest-mock]</code> Revert <a href="https://snyk.io/redirect/github/facebook/jest/pull/13398" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13398/hovercard">#13398</a> to restore mocking of setters (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13472" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13472/hovercard">#13472</a>)</li> </ul> <h2>Performance</h2> <ul> <li><code>[*]</code> Use sha1 instead of sha256 for hashing (<a href="https://snyk.io/redirect/github/facebook/jest/pull/13421" data-hovercard-type="pull_request" data-hovercard-url="/jestjs/jest/pull/13421/hovercard">#13421</a>)</li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https://snyk.io/redirect/github/facebook/jest/compare/v29.2.0...v29.2.1"><tt>v29.2.0...v29.2.1</tt></a></p> </li> <li> <b>29.2.0</b> - <a href="https://snyk.io/redirect/github/facebook/jest/releases/tag/v29.2.0">2022-10-14</a></br><a href="https://snyk.io/redirect/github/facebook/jest/releases/tag/v29.2.0"> Read more </a> </li> <li> <b>29.1.2</b> - <a href="https://snyk.io/redirect/github/facebook/jest/releases/tag/v29.1.2">2022-09-30</a></br><a href="https://snyk.io/redirect/github/facebook/jest/releases/tag/v29.1.2"> Read more </a> </li> </ul> from <a href="https://snyk.io/redirect/github/facebook/jest/releases">jest GitHub release notes</a> </details> </details> <details> <summary><b>Commit messages</b></summary> </br> <details> <summary>Package name: <b>babel-jest</b></summary> <ul> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/05deb8393c4ad71e19be2567b704dfd3a2ab5fc9">05deb83</a> v29.3.1</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/5b38cfb3fcc12eecc110381ae3d9d7c6bff07d06">5b38cfb</a> chore: update changelog for release</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/291f2016af13269d2128d4905459ab4082c07721">291f201</a> fix(jest-config): do not warn about presets in project config (#13583)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/dfc87111e708b9294dc54ab0c17712972d042c1c">dfc8711</a> chore: use `@ fast-check/jest` (#13493)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/b027fb0791c28dfe8c6206fc77286b90ab70d243">b027fb0</a> ci: remove git credentials after checkout (#13574)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/1c3565f6e5d6a8e987417f688004f340d9bfcb72">1c3565f</a> Defer creation of cache directory (#13420)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/ba20c150df6cd3c3a73a0a700d000e6cd7778a19">ba20c15</a> refactor(jest-mock): clean up internal typings more (#13575)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/a570638d6325dac0a52034ce0d208790af3fcf1a">a570638</a> website: build on node 16 since 18 is broken</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/a83e8edb44722d0de1cdc6af956f9e482650dc3c">a83e8ed</a> refactor(jest-mock): clean up internal typings (#13571)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/84b8de987b33e2da20dc833aeb65f23d72a673cd">84b8de9</a> v29.3.0</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/2bc237704d19da87a4949b2b609a429c23473031">2bc2377</a> chore: roll new version of the docs</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/6e24f3188252397213c23a6655d3772da793887a">6e24f31</a> chore: update changelog for release</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/c2046d5d306a8e54e95a701ab04f54c50b793488">c2046d5</a> chore(docs): fix even more prettier violations</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/35fd91d876395292cb59379603eb8c12cb8e21fa">35fd91d</a> chore: fix lint issue introduced in #13556 (#13569)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/fb4f48764ed975b6386e43005af644b8bb53e7a8">fb4f487</a> docs: correct grammar in GettingStarted.md (#13533)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/fb2daf49f3a5a819a479ef825409ef94458ae67f">fb2daf4</a> docs: add explanation for `supportsStaticESM` transform option (#12028)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/73550fd12e3a6ca870f5fe62022d51f33680f5e1">73550fd</a> Doc: Update documentation on usage with Webpack (#13556)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/491827b9310d5dc61f64a8b06427bad5a22c13bc">491827b</a> docs: usingMatchers mention toStrictEqual (#13560)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/f75a3aa988d61036331df00b07e4311bb06985a6">f75a3aa</a> fix: config silently ignored in projects (#13565)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/195cb4b24f6cdce5a8a77851387cfe883fb39763">195cb4b</a> fix(jest-worker): fix hanging when workers are killed or unexpectedly exit (#13566)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/6483979d6f1c1d7d078dd6c049d31701a5b9f2db">6483979</a> feat: support WebAssembly (Wasm) imports in ESM modules (#13505)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/7c48c4c6d36661fd4425acedc87faff69f4b54c4">7c48c4c</a> refactor(jest-reporters): remove useless conditional (#13564)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/bb28e7962b85caa861eb95431c52c7297947c981">bb28e79</a> refactor(jest-mock): remove useless conditional (#13561)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/4670d3be0d80d47844673eb163666253e788f006">4670d3b</a> chore(deps-dev): bump which from 2.0.2 to 3.0.0 (#13554)</li> </ul> <a href="https://snyk.io/redirect/github/facebook/jest/compare/3c31dd619e8c022cde53f40fa12ea2a67f4752ce...05deb8393c4ad71e19be2567b704dfd3a2ab5fc9">Compare</a> </details> <details> <summary>Package name: <b>jest</b></summary> <ul> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/05deb8393c4ad71e19be2567b704dfd3a2ab5fc9">05deb83</a> v29.3.1</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/5b38cfb3fcc12eecc110381ae3d9d7c6bff07d06">5b38cfb</a> chore: update changelog for release</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/291f2016af13269d2128d4905459ab4082c07721">291f201</a> fix(jest-config): do not warn about presets in project config (#13583)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/dfc87111e708b9294dc54ab0c17712972d042c1c">dfc8711</a> chore: use `@ fast-check/jest` (#13493)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/b027fb0791c28dfe8c6206fc77286b90ab70d243">b027fb0</a> ci: remove git credentials after checkout (#13574)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/1c3565f6e5d6a8e987417f688004f340d9bfcb72">1c3565f</a> Defer creation of cache directory (#13420)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/ba20c150df6cd3c3a73a0a700d000e6cd7778a19">ba20c15</a> refactor(jest-mock): clean up internal typings more (#13575)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/a570638d6325dac0a52034ce0d208790af3fcf1a">a570638</a> website: build on node 16 since 18 is broken</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/a83e8edb44722d0de1cdc6af956f9e482650dc3c">a83e8ed</a> refactor(jest-mock): clean up internal typings (#13571)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/84b8de987b33e2da20dc833aeb65f23d72a673cd">84b8de9</a> v29.3.0</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/2bc237704d19da87a4949b2b609a429c23473031">2bc2377</a> chore: roll new version of the docs</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/6e24f3188252397213c23a6655d3772da793887a">6e24f31</a> chore: update changelog for release</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/c2046d5d306a8e54e95a701ab04f54c50b793488">c2046d5</a> chore(docs): fix even more prettier violations</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/35fd91d876395292cb59379603eb8c12cb8e21fa">35fd91d</a> chore: fix lint issue introduced in #13556 (#13569)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/fb4f48764ed975b6386e43005af644b8bb53e7a8">fb4f487</a> docs: correct grammar in GettingStarted.md (#13533)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/fb2daf49f3a5a819a479ef825409ef94458ae67f">fb2daf4</a> docs: add explanation for `supportsStaticESM` transform option (#12028)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/73550fd12e3a6ca870f5fe62022d51f33680f5e1">73550fd</a> Doc: Update documentation on usage with Webpack (#13556)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/491827b9310d5dc61f64a8b06427bad5a22c13bc">491827b</a> docs: usingMatchers mention toStrictEqual (#13560)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/f75a3aa988d61036331df00b07e4311bb06985a6">f75a3aa</a> fix: config silently ignored in projects (#13565)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/195cb4b24f6cdce5a8a77851387cfe883fb39763">195cb4b</a> fix(jest-worker): fix hanging when workers are killed or unexpectedly exit (#13566)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/6483979d6f1c1d7d078dd6c049d31701a5b9f2db">6483979</a> feat: support WebAssembly (Wasm) imports in ESM modules (#13505)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/7c48c4c6d36661fd4425acedc87faff69f4b54c4">7c48c4c</a> refactor(jest-reporters): remove useless conditional (#13564)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/bb28e7962b85caa861eb95431c52c7297947c981">bb28e79</a> refactor(jest-mock): remove useless conditional (#13561)</li> <li><a href="https://snyk.io/redirect/github/facebook/jest/commit/4670d3be0d80d47844673eb163666253e788f006">4670d3b</a> chore(deps-dev): bump which from 2.0.2 to 3.0.0 (#13554)</li> </ul> <a href="https://snyk.io/redirect/github/facebook/jest/compare/3c31dd619e8c022cde53f40fa12ea2a67f4752ce...05deb8393c4ad71e19be2567b704dfd3a2ab5fc9">Compare</a> </details> </details> <hr/> **Note:** *You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.* For more information: <img src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiJmZmUwYjFkZi0yMzY2LTRiOGYtOTg5MC03YmQ1NDgwNjMwYTgiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6ImZmZTBiMWRmLTIzNjYtNGI4Zi05ODkwLTdiZDU0ODA2MzBhOCJ9fQ==" width="0" height="0"/> 🧐 [View latest project report](https://app.snyk.io/org/sandbox-2ba/project/852e6e4f-be96-45c8-b370-1060f5ebee55?utm_source=github&utm_medium=referral&page=upgrade-pr) 🛠 [Adjust upgrade PR settings](https://app.snyk.io/org/sandbox-2ba/project/852e6e4f-be96-45c8-b370-1060f5ebee55/settings/integration?utm_source=github&utm_medium=referral&page=upgrade-pr) 🔕 [Ignore this dependency or unsubscribe from future upgrade PRs](https://app.snyk.io/org/sandbox-2ba/project/852e6e4f-be96-45c8-b370-1060f5ebee55/settings/integration?pkg=babel-jest&pkg=jest&utm_source=github&utm_medium=referral&page=upgrade-pr#auto-dep-upgrades) <!--- (snyk:metadata:{"prId":"ffe0b1df-2366-4b8f-9890-7bd5480630a8","prPublicId":"ffe0b1df-2366-4b8f-9890-7bd5480630a8","dependencies":[{"name":"babel-jest","from":"29.1.2","to":"29.3.1"},{"name":"jest","from":"29.1.2","to":"29.3.1"}],"packageManager":"npm","type":"auto","projectUrl":"https://app.snyk.io/org/sandbox-2ba/project/852e6e4f-be96-45c8-b370-1060f5ebee55?utm_source=github&utm_medium=referral&page=upgrade-pr","projectPublicId":"852e6e4f-be96-45c8-b370-1060f5ebee55","env":"prod","prType":"upgrade","vulns":[],"issuesToFix":[],"upgrade":[],"upgradeInfo":{"versionsDiff":5,"publishedDate":"2022-11-08T22:56:28.239Z"},"templateVariants":[],"hasFixes":false,"isMajorUpgrade":false,"isBreakingChange":false,"priorityScoreList":[]}) ---> Co-authored-by: snyk-bot <[email protected]>
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. |
Summary
When retrieving mock metadata of recent node modules, jest fails with the error
Error: Failed to get mock metadata
An example of a node module that will fail mocking is
@sentry/vue
version 7.16 while version 7.15 will notHere is the difference between the 2 versions
As you can see, no difference except es6 modernization and this
[Symbol.toStringTag]: { value: 'Module' }
But jest does not know how to handle
jest.mock('@sentry/vue')
with this new versionTest plan
I did a test mocking
jest.mock('@sentry/vue')
before this change which fails with the previous errorAnd after this change the module is correctly mocked
Before the change
getType
would returnnull
for an[Object Module]
which shortcircuited the metadata retrievial and failed, now it returnsobject
and retrieves metadata correctlyHere is a repo demonstrating the issue
https://github.com/Tofandel/sentry-vue-bug
This PR will very likely fix #678