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

pool: vmThreads breaks source maps in tests #5118

Closed
6 tasks done
sambev opened this issue Feb 5, 2024 · 1 comment
Closed
6 tasks done

pool: vmThreads breaks source maps in tests #5118

sambev opened this issue Feb 5, 2024 · 1 comment

Comments

@sambev
Copy link

sambev commented Feb 5, 2024

Describe the bug

When using vmThreads instead of threads (or the default), source maps seem to break while running the tests.

Small repro: https://github.com/sambev/vmthread-sourcemap-repro

With pool: 'threads', reporting works as expected

 FAIL  src/__tests__/sum.test.ts > sum
TypeError: Cannot set properties of undefined (setting 'name')
 ❯ Module.sum src/sum.ts:7:12
      5|
      6| export function sum(items: Item[]): number {
      7|   items[3].name = "break!";
       |            ^
      8|   return items.reduce((acc, item) => acc + item.count, 0);
      9| }
 ❯ src/__tests__/sum.test.ts:10:10

With pool: 'vmThreads', reporting is wrong:

  FAIL  src/__tests__/sum.test.ts > sum
TypeError: Cannot set properties of undefined (setting 'name')
 ❯ Module.sum src/sum.ts:2:17
      1| interface Item {
      2|   name: string;
       |                 ^
      3|   count: number;
      4| }
 ❯ src/__tests__/sum.test.ts:10:54

Reproduction

I have made a simple reproduction app based on the vanilla-ts vite template here:

https://github.com/sambev/vmthread-sourcemap-repro

All you should have to do is install deps (yarn install) and run tests (yarn test)

System Info

System:
    OS: macOS 14.3
    CPU: (8) arm64 Apple M1 Pro
    Memory: 86.81 MB / 16.00 GB
    Shell: 3.6.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 18.12.1 - ~/.volta/tools/image/node/18.12.1/bin/node
    Yarn: 1.22.19 - ~/.volta/tools/image/yarn/1.22.19/bin/yarn
    npm: 8.19.2 - ~/.volta/tools/image/node/18.12.1/bin/npm
  Browsers:
    Chrome: 121.0.6167.139
    Safari: 17.3
  npmPackages:
    vite: ^5.0.8 => 5.0.12
    vitest: ^1.2.2 => 1.2.2

Used Package Manager

yarn

Validations

@hi-ogawa
Copy link
Contributor

hi-ogawa commented Feb 5, 2024

This is expected to be fixed by #5063 (it's not released yet but probably soon). The issue is previously reported in #5058 as inline snapshot bugs, but the underlying issue should be same.

I just updated the previous issue's title to mention source map, so it's easier for people to find a duplicate. Sorry about the confusion.

@hi-ogawa hi-ogawa closed this as completed Feb 5, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants