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

Mocking is lost when threads: false is set #482

Closed
6 tasks done
EvHaus opened this issue Jan 8, 2022 · 2 comments
Closed
6 tasks done

Mocking is lost when threads: false is set #482

EvHaus opened this issue Jan 8, 2022 · 2 comments

Comments

@EvHaus
Copy link
Contributor

EvHaus commented Jan 8, 2022

Describe the bug

I'm seeing a strange behavior with threads: false which might be related to #468 and #294. When you mock modules, the mocking works on initial run, but mocks are reset to undefined when watch mode refreshes, or the when another suite runs.

Reproduction

Use this tiny repro suite where I mock the ora package: https://stackblitz.com/edit/node-72ecu4?file=index.ts

To reproduce the problem, run the stackblits as normal. You'll notice the initial run works without any issues.

Then make any edit to any file (ie. add some white space) to trigger watch mode to re-run the tests. You'll see that the tests now fail with:

TypeError: Cannot read properties of undefined (reading 'start')

This is because the ora mock somehow becomes undefined.

System Info

System:
    OS: macOS 12.1
    CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
    Memory: 32.75 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.1.2 - ~/.nvm/versions/node/v16.13.1/bin/npm
    Watchman: 2022.01.03.00 - /usr/local/bin/watchman
  Browsers:
    Chrome: 97.0.4692.71
    Chrome Canary: 99.0.4813.0
    Firefox: 95.0
    Safari: 15.2

Used Package Manager

npm

Validations

@sheremet-va
Copy link
Member

This is kinda an experimental fix. I remember why we added that line, but locally all is fine after removing it.

Let me know if it adds new issues :S

JakeGinnivan pushed a commit to JakeGinnivan/vitest that referenced this issue Jan 8, 2022
vikunja-bot pushed a commit to go-vikunja/frontend that referenced this issue Jan 10, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [vitest](https://github.com/vitest-dev/vitest) | devDependencies | patch | [`0.0.139` -> `0.0.140`](https://renovatebot.com/diffs/npm/vitest/0.0.139/0.0.140) |

---

### Release Notes

<details>
<summary>vitest-dev/vitest</summary>

### [`v0.0.140`](https://github.com/vitest-dev/vitest/releases/v0.0.140)

[Compare Source](vitest-dev/vitest@v0.0.139...v0.0.140)

##### Bug Fixes

-   inline snapshot if not called inside suite ([6d743c5](vitest-dev/vitest@6d743c5)), closes [#&#8203;484](vitest-dev/vitest#484)
-   **ui:** flex / percentage based layout ([#&#8203;492](vitest-dev/vitest#492)) ([c43ebaf](vitest-dev/vitest@c43ebaf))
-   correctly inline shapshot with properties ([4603ffd](vitest-dev/vitest@4603ffd))
-   mocking is lost with threads: false ([28b97d8](vitest-dev/vitest@28b97d8)), closes [#&#8203;482](vitest-dev/vitest#482)
-   Reflect.get called on non-object ([3c9073a](vitest-dev/vitest@3c9073a)), closes [#&#8203;479](vitest-dev/vitest#479)
-   snapshot ignores indentation ([aff1481](vitest-dev/vitest@aff1481))
-   **ui:** reduce graph container size ([#&#8203;478](vitest-dev/vitest#478)) ([23e1e62](vitest-dev/vitest@23e1e62))

##### Features

-   global setup ([#&#8203;372](vitest-dev/vitest#372)) ([eaa119f](vitest-dev/vitest@eaa119f))
-   **ui:** tasks state group ([7782e7d](vitest-dev/vitest@7782e7d))

</details>

---

### Configuration

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

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **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, check this box.

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).

Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/1348
Co-authored-by: renovate <renovatebot@kolaente.de>
Co-committed-by: renovate <renovatebot@kolaente.de>
@EvHaus
Copy link
Contributor Author

EvHaus commented Jan 11, 2022

Seems to be working well for me. Thank you!

@github-actions github-actions bot locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants