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

adding ts-jest mock util functions in jest-mock #12089

Merged
merged 9 commits into from
Nov 29, 2021
Merged

adding ts-jest mock util functions in jest-mock #12089

merged 9 commits into from
Nov 29, 2021

Conversation

k-rajat19
Copy link
Contributor

@k-rajat19 k-rajat19 commented Nov 25, 2021

Summary

This PR can close #9534 which was opened as a feature request by @ahnpnl

This PR includes -

there is also another proposal for partialMocked in kulshekhar/ts-jest#1065 which can be added after these changes are approved.

Any suggestions/ changes which can help in closing the above issue are most welcome.

@codecov-commenter
Copy link

codecov-commenter commented Nov 25, 2021

Codecov Report

Merging #12089 (93234bd) into main (1f813fa) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #12089      +/-   ##
==========================================
- Coverage   68.89%   68.89%   -0.01%     
==========================================
  Files         324      324              
  Lines       16669    16672       +3     
  Branches     4814     4814              
==========================================
+ Hits        11484    11486       +2     
- Misses       5152     5153       +1     
  Partials       33       33              
Impacted Files Coverage Δ
packages/jest-mock/src/index.ts 85.09% <100.00%> (+0.10%) ⬆️
packages/expect/src/utils.ts 95.85% <0.00%> (-0.52%) ⬇️

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 1f813fa...93234bd. Read the comment docs.

@ahnpnl
Copy link
Contributor

ahnpnl commented Nov 25, 2021

Documentation https://github.com/facebook/jest/tree/main/docs would need to be updated as well as CHANGELOG too :)

@k-rajat19
Copy link
Contributor Author

k-rajat19 commented Nov 25, 2021

Typescript compiler is not able to validate definition files
this may be due to ts-jest type MockedFunction ?

@ahnpnl
Copy link
Contributor

ahnpnl commented Nov 25, 2021

The whole mocked from ts-jest relies partially on @types/jest. I think the TypeScript build failure is connected to that. Probably because @types/jest isn't a direct dependency of jest-mock package.

Copy link
Member

@SimenB SimenB left a comment

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 ee24dfc into jestjs:main Nov 29, 2021
boonya added a commit to boonya/react-hook-form-validation that referenced this pull request Dec 18, 2021
@mikemaccana
Copy link
Contributor

mikemaccana commented Jan 5, 2022

For those a who came here from the warning:

velut added a commit to jsdocs-io/extractor that referenced this pull request Jan 17, 2022
bors bot referenced this pull request in foosbyte/kicker-trainer Jan 21, 2022
1480: chore: update dependency @types/react to v16.14.21 r=renovate[bot] a=renovate[bot]

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [`@types/react](https://togithub.com/DefinitelyTyped/DefinitelyTyped)` | [`16.9.56` -> `16.14.21`](https://renovatebot.com/diffs/npm/`@types%2freact/16.9.56/16.14.21)` | [![age](https://badges.renovateapi.com/packages/npm/`@types%2freact/16.14.21/age-slim)](https://docs.renovatebot.com/merge-confidence/)` | [![adoption](https://badges.renovateapi.com/packages/npm/`@types%2freact/16.14.21/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)` | [![passing](https://badges.renovateapi.com/packages/npm/`@types%2freact/16.14.21/compatibility-slim/16.9.56)](https://docs.renovatebot.com/merge-confidence/)` | [![confidence](https://badges.renovateapi.com/packages/npm/`@types%2freact/16.14.21/confidence-slim/16.9.56)](https://docs.renovatebot.com/merge-confidence/)` |

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/foosbyte/kicker-trainer).

1481: chore: update dependency ts-jest to v27.1.3 r=renovate[bot] a=renovate[bot]

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [ts-jest](https://kulshekhar.github.io/ts-jest) ([source](https://togithub.com/kulshekhar/ts-jest)) | [`27.0.7` -> `27.1.3`](https://renovatebot.com/diffs/npm/ts-jest/27.0.7/27.1.3) | [![age](https://badges.renovateapi.com/packages/npm/ts-jest/27.1.3/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/ts-jest/27.1.3/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/ts-jest/27.1.3/compatibility-slim/27.0.7)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/ts-jest/27.1.3/confidence-slim/27.0.7)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>kulshekhar/ts-jest</summary>

### [`v27.1.3`](https://togithub.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2713-httpsgithubcomkulshekharts-jestcomparev2712v2713-2022-01-14)

[Compare Source](https://togithub.com/kulshekhar/ts-jest/compare/v27.1.2...v27.1.3)

##### Bug Fixes

-   **compiler:** update memory cache for compiler using received file content ([#&#8203;3194](https://togithub.com/kulshekhar/ts-jest/issues/3194)) ([e4d9541](https://togithub.com/kulshekhar/ts-jest/commit/e4d9541f262ca14cb25563c757c0f2345dbf5c51))

### [`v27.1.2`](https://togithub.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2712-httpsgithubcomkulshekharts-jestcomparev2711v2712-2021-12-15)

[Compare Source](https://togithub.com/kulshekhar/ts-jest/compare/v27.1.1...v27.1.2)

##### Bug Fixes

-   stimulate `esbuild` type to avoid importing `esbuild` directly ([#&#8203;3147](https://togithub.com/kulshekhar/ts-jest/issues/3147)) ([9ace0a9](https://togithub.com/kulshekhar/ts-jest/commit/9ace0a9991da8bcb0f04a2e603f7601d6fb630e7))

### [`v27.1.1`](https://togithub.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2711-httpsgithubcomkulshekharts-jestcomparev2710v2711-2021-12-07)

[Compare Source](https://togithub.com/kulshekhar/ts-jest/compare/v27.1.0...v27.1.1)

##### Bug Fixes

-   bring back `afterProcess` hook ([#&#8203;3132](https://togithub.com/kulshekhar/ts-jest/issues/3132)) ([2b6b86e](https://togithub.com/kulshekhar/ts-jest/commit/2b6b86e01dcd3d9d9906f24fe3db5cadb799146a))
-   make `esbuild` as optional peer dependency ([#&#8203;3129](https://togithub.com/kulshekhar/ts-jest/pull/3129)) ([20258de](https://togithub.com/kulshekhar/ts-jest/commit/20258de54c9c10f8d2495bda174f9865a3cebc91))

### [`v27.1.0`](https://togithub.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2710-httpsgithubcomkulshekharts-jestcomparev2707v2710-2021-11-30)

[Compare Source](https://togithub.com/kulshekhar/ts-jest/compare/v27.0.7...v27.1.0)

##### Features

-   allow subclasses to extend `processAsync` and `getCacheKeyAsync` ([#&#8203;3047](https://togithub.com/kulshekhar/ts-jest/issues/3047)) ([571a880](https://togithub.com/kulshekhar/ts-jest/commit/571a880007642c9dcbcd7bf109c5392e7eb78cc4))
-   **config:** support custom AST transformers written in TypeScript ([#&#8203;3063](https://togithub.com/kulshekhar/ts-jest/issues/3063)) ([340a305](https://togithub.com/kulshekhar/ts-jest/commit/340a30573e5ff92df77c94af51c371ce4bf956e7)), closes [#&#8203;2831](https://togithub.com/kulshekhar/ts-jest/issues/2831)
-   export `ts-jest` public apis from `index.js` ([#&#8203;3080](https://togithub.com/kulshekhar/ts-jest/issues/3080)) ([53175dd](https://togithub.com/kulshekhar/ts-jest/commit/53175dd04218bf22ead464e30aa01b258c87e7af)), closes [#&#8203;3045](https://togithub.com/kulshekhar/ts-jest/issues/3045)

##### Code Refactoring

-   **utils:** deprecate `mocked` util function ([#&#8203;3102](https://togithub.com/kulshekhar/ts-jest/issues/3102)) ([55e69f1](https://togithub.com/kulshekhar/ts-jest/commit/55e69f12f65d678962c3087fca7673992f5f1b26))
-   define clear type for `compiler` option ([#&#8203;3087](https://togithub.com/kulshekhar/ts-jest/issues/3087)) ([cc42daf](https://togithub.com/kulshekhar/ts-jest/commit/cc42daf795585887664be59956d2c52244237bda))
-   **transformers**: deprecate `path-mapping` AST transformer ([#&#8203;3088](https://togithub.com/kulshekhar/ts-jest/issues/3088)) ([d8f6b96](https://togithub.com/kulshekhar/ts-jest/commit/d8f6b9624ee76a164aa7003720cd3f83fc6c4865))
-   **transformers**: use ts `factory` API for `hoisting` AST transformer ([#&#8203;3058](https://togithub.com/kulshekhar/ts-jest/issues/3058)) ([a72f51d](https://togithub.com/kulshekhar/ts-jest/commit/a72f51d9b7c4ea2866e486c0aac4f4706c3ed542))

#### DEPRECATIONS

-   **transformers**: `path-mapping` AST transformer is deprecated and will be removed in **v28.0.0**. One should use an alternative one like https://github.com/LeDDGroup/typescript-transform-paths instead.
-   **utils**: `mocked` function is deprecated and will be removed in **v28.0.0**. The function has been integrated into `jest-mock` package as a part of Jest **27.4.0**, see [https://github.com/facebook/jest/pull/12089](https://togithub.com/facebook/jest/pull/12089). One should use the one from Jest instead

#### [27.0.7](https://togithub.com/kulshekhar/ts-jest/compare/v27.0.6...v27.0.7) (2021-10-16)

##### Bug Fixes

-   correct `lodash` import ([#&#8203;2978](https://togithub.com/kulshekhar/ts-jest/issues/2978)) ([8b60679](https://togithub.com/kulshekhar/ts-jest/commit/8b60679574eb60a3c8109ffd389b64b86a167e72)), closes [#&#8203;2977](https://togithub.com/kulshekhar/ts-jest/issues/2977)

#### [27.0.6](https://togithub.com/kulshekhar/ts-jest/compare/v27.0.5...v27.0.6) (2021-10-14)

##### Bug Fixes

-   use specific `lodash` package instead of full package `lodash` ([#&#8203;2959](https://togithub.com/kulshekhar/ts-jest/issues/2959)) ([dc89fe5](https://togithub.com/kulshekhar/ts-jest/commit/dc89fe55f2b77da76443f827fe3055f07cf4809c)), closes [#&#8203;2954](https://togithub.com/kulshekhar/ts-jest/issues/2954)

#### [27.0.5](https://togithub.com/kulshekhar/ts-jest/compare/v27.0.4...v27.0.5) (2021-08-14)

##### Bug Fixes

-   **cli:** add migration `tsConfig` option for `ts-jest` config options ([#&#8203;2794](https://togithub.com/kulshekhar/ts-jest/issues/2794)) ([781710b](https://togithub.com/kulshekhar/ts-jest/commit/781710bf6b84853fffbb02543062a726fe1ad9c2)), closes [#&#8203;2764](https://togithub.com/kulshekhar/ts-jest/issues/2764)
-   **cli:** fix `config:init` genarate invalid type comment ([#&#8203;2773](https://togithub.com/kulshekhar/ts-jest/issues/2773)) ([ede8a20](https://togithub.com/kulshekhar/ts-jest/commit/ede8a2061e20b717c0d56e4d81a3cd0ec7db8b1a)), closes [#&#8203;2772](https://togithub.com/kulshekhar/ts-jest/issues/2772)
-   **config:** handle  `./` in tsconfig `paths` for `pathsToModuleNameMapper`  ([#&#8203;2797](https://togithub.com/kulshekhar/ts-jest/issues/2797)) ([42ff5e4](https://togithub.com/kulshekhar/ts-jest/commit/42ff5e469fb5d315b92e85eee105e5a040949c01)), closes [#&#8203;2709](https://togithub.com/kulshekhar/ts-jest/issues/2709)

##### Code Refactoring

-   use native `Buffer.from` and `mkdird` ([#&#8203;2774](https://togithub.com/kulshekhar/ts-jest/issues/2774)) ([4869660](https://togithub.com/kulshekhar/ts-jest/commit/4869660e3917deb063745c5acaf079123d6d2ca8))

#### [27.0.4](https://togithub.com/kulshekhar/ts-jest/compare/v27.0.3...v27.0.4) (2021-07-21)

##### Bug Fixes

-   add ``@types/jest`` as optional `peerDependencies` to solve yarn 2 ([#&#8203;2756](https://togithub.com/kulshekhar/ts-jest/issues/2756)) ([5fbf43e](https://togithub.com/kulshekhar/ts-jest/commit/5fbf43e64691d5146add1da4690a14b3095c4234))
-   add `babel-jest` as optional `peerDependencies` to solve yarn 2 ([#&#8203;2751](https://togithub.com/kulshekhar/ts-jest/issues/2751)) ([8bede2e](https://togithub.com/kulshekhar/ts-jest/commit/8bede2e57546a18999b96871069f1f94a3ecf3c1))
-   **config:** include AST transformer's `name` and `version` into cache key ([#&#8203;2755](https://togithub.com/kulshekhar/ts-jest/issues/2755)) ([310fb9a](https://togithub.com/kulshekhar/ts-jest/commit/310fb9a1d7b40a8274d6fb93745e66a6da891a75)), closes [#&#8203;2753](https://togithub.com/kulshekhar/ts-jest/issues/2753)

##### Features

-   link jest config types on `npx ts-jest:init` ([#&#8203;2742](https://togithub.com/kulshekhar/ts-jest/issues/2742)) ([f51ba05](https://togithub.com/kulshekhar/ts-jest/commit/f51ba0507568ba8a5dece48c159d7857a2ed61d6))
-   set env var `TS_JEST` to allow detecting of `ts-jest` ([#&#8203;2717](https://togithub.com/kulshekhar/ts-jest/issues/2717)) ([56c137a](https://togithub.com/kulshekhar/ts-jest/commit/56c137a3c1906f49cb0b9e044fa8e233707cbaa4)), closes [#&#8203;2716](https://togithub.com/kulshekhar/ts-jest/issues/2716)

#### [27.0.3](https://togithub.com/kulshekhar/ts-jest/compare/v27.0.2...v27.0.3) (2021-06-06)

##### Bug Fixes

-   revert `exports` field to support all node versions ([#&#8203;2658](https://togithub.com/kulshekhar/ts-jest/issues/2658)) ([132c8ba](https://togithub.com/kulshekhar/ts-jest/commit/132c8ba85c3e61b7d9ede0dc9730580b79618ab7))

##### Features

-   emit ESM codes if using ESM mode with Babel ([#&#8203;2661](https://togithub.com/kulshekhar/ts-jest/issues/2661)) ([9b55404](https://togithub.com/kulshekhar/ts-jest/commit/9b55404a8dfc760238e19786da98a2edf043b9da)), closes [#&#8203;2650](https://togithub.com/kulshekhar/ts-jest/issues/2650)

#### [27.0.2](https://togithub.com/kulshekhar/ts-jest/compare/v27.0.1...v27.0.2) (2021-05-30)

##### Bug Fixes

-   **compiler:** add empty string file content to compiler cache ([#&#8203;2633](https://togithub.com/kulshekhar/ts-jest/issues/2633)) ([0feb556](https://togithub.com/kulshekhar/ts-jest/commit/0feb5560a588f87d1d989bf521859fba0fda20fe)), closes [#&#8203;2625](https://togithub.com/kulshekhar/ts-jest/issues/2625)
-   **config:** `exclude` should only exclude files which match glob values ([#&#8203;2637](https://togithub.com/kulshekhar/ts-jest/issues/2637)) ([c5ce979](https://togithub.com/kulshekhar/ts-jest/commit/c5ce97902c1b84dc354f270a4f596a6f5f634611)), closes [#&#8203;2634](https://togithub.com/kulshekhar/ts-jest/issues/2634)

#### [27.0.1](https://togithub.com/kulshekhar/ts-jest/compare/v27.0.0...v27.0.1) (2021-05-26)

##### Bug Fixes

-   **cli:** keep `testMatch` if old jest config contains it ([#&#8203;2618](https://togithub.com/kulshekhar/ts-jest/issues/2618)) ([c568f49](https://togithub.com/kulshekhar/ts-jest/commit/c568f49907fb5559ba1e8c67f1ec5d5eb4af920a)), closes [#&#8203;2616](https://togithub.com/kulshekhar/ts-jest/issues/2616)
-   **compiler:** make sure `isolatedModules: false` use updated compiler options ([#&#8203;2628](https://togithub.com/kulshekhar/ts-jest/issues/2628)) ([348e30f](https://togithub.com/kulshekhar/ts-jest/commit/348e30f426803efc51ecba26ab42619938fcb5af)), closes [#&#8203;2629](https://togithub.com/kulshekhar/ts-jest/issues/2629)
-   add missing export `presets` ([#&#8203;2624](https://togithub.com/kulshekhar/ts-jest/issues/2624)) ([0ea025e](https://togithub.com/kulshekhar/ts-jest/commit/0ea025ebb456d3a31671e31fac0b401c2734a2b1)), closes [#&#8203;2623](https://togithub.com/kulshekhar/ts-jest/issues/2623)

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/foosbyte/kicker-trainer).

Co-authored-by: Renovate Bot <[email protected]>
boonya added a commit to boonya/rtsp-video-recorder that referenced this pull request Jan 24, 2022
boonya added a commit to boonya/rtsp-video-recorder that referenced this pull request Jan 24, 2022
* [Fixed][Issue #195] Using spaces in title results in ffmpeg error.

* Dev Dependencies bumped

* jest.mocked instead of ts-jest/mocked due to jestjs/jest#12089
boonya added a commit to boonya/react-hook-form-validation that referenced this pull request Jan 26, 2022
* All dependecies are up to date + jest.mocked instead of ts-jest mocked due to jestjs/jest#12089

* Example removed

* React Styleguidist first try

* Better documentation

* Styled documentation, changed min & max validators, removed special validators, workflows are tuned up

* Reusable docs workflow

* Reusable docs workflow fix

* Additional item in changelog

* Reusable docs workflow fix

* Validators refactored

* Invert validators result

* Readme

* min & length validators + integration test suites

* fix

* fix

* one more fix

* Exclude/ignore file(s) from Jest coverage by not running relevant tests

* fix

* code dublication avoided

* Seems work

* Bumped dependencies

* Docs
@github-actions
Copy link

github-actions bot commented Feb 5, 2022

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 Feb 5, 2022
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.

Include ts-jest mock util functions in jest core
6 participants