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

Asymmetric matcher utilities broken in v0.28+ #2744

Closed
6 tasks done
simon-abbott opened this issue Jan 24, 2023 · 5 comments · Fixed by #2768
Closed
6 tasks done

Asymmetric matcher utilities broken in v0.28+ #2744

simon-abbott opened this issue Jan 24, 2023 · 5 comments · Fixed by #2768

Comments

@simon-abbott
Copy link
Contributor

Describe the bug

482b72f changed the exported types of jest-matcher-utils. The corresponding import in jest-extend was changed accordingly, but the one in jest-asymmetric-matchers was not. This causes any asymmetric matchers that use methods like matcherHint or printExpected to fail.

Reproduction

Make a custom asymmetric matcher and look at the value of this.utils.

System Info

System:
    OS: macOS 13.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 247.17 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
    Yarn: 1.22.19 - ~/Programming/Airfordable/ohare/node_modules/.bin/yarn
    npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm
    Watchman: 2023.01.09.00 - /usr/local/bin/watchman
  Browsers:
    Brave Browser: 90.1.24.86
    Chrome: 104.0.5112.101
    Firefox: 109.0
    Firefox Developer Edition: 109.0
    Safari: 16.2
  npmPackages:
    @vitest/ui: 0.28.1 => 0.28.1 
    vitest: 0.28.1 => 0.28.1

Used Package Manager

npm

Validations

@Vithanco
Copy link

I assume this is the same as my problem:

TypeError: Cannot destructure property 'AsymmetricMatcher' of '__vite_ssr_import_0__.plugins' as it is undefined.
 ❯ node_modules/@vitest/utils/dist/index.js:22:3
     20|   AsymmetricMatcher
     21| ];
     22| function stringify(object, maxDepth = 10, { maxLength, ...options } = {}) {
       |   ^
     23|   const MAX_LENGTH = maxLength ?? 1e4;
     24|   let result;
 ❯ VitestRunner.directRequest node_modules/vite-node/dist/client.mjs:308:5
 ❯ VitestRunner.cachedRequest node_modules/vite-node/dist/client.mjs:156:14
 ❯ VitestRunner.dependencyRequest node_modules/vite-node/dist/client.mjs:206:14
 ❯ async /Users/knownToAuthor/node_modules/@vitest/runner/dist/index.js:3:31
 ❯ VitestRunner.directRequest node_modules/vite-node/dist/client.mjs:308:5
 ❯ VitestRunner.cachedRequest node_modules/vite-node/dist/client.mjs:156:14
 ❯ VitestRunner.dependencyRequest node_modules/vite-node/dist/client.mjs:206:14
 ❯ async /Users/knownToAuthor/node_modules/vitest/dist/entry.js:5:31
 ❯ VitestRunner.directRequest node_modules/vite-node/dist/client.mjs:308:5

@ElkostVN
Copy link

Yes, I faced the same problem

Vitest caught 1 unhandled error during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.
⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯
TypeError: Cannot destructure property 'AsymmetricMatcher' of '__vite_ssr_import_0__.plugins' as it is undefined.
 ❯ ../../node_modules/@vitest/utils/dist/index.js:22:3
     20|   AsymmetricMatcher
     21| ];
     22| function stringify(object, maxDepth = 10, { maxLength, ...options } = …
       |   ^
     23|   const MAX_LENGTH = maxLength ?? 1e4;
     24|   let result;
 ❯ VitestRunner.directRequest ../../node_modules/vite-node/dist/client.mjs:308:5
 ❯ VitestRunner.cachedRequest ../../node_modules/vite-node/dist/client.mjs:156:14
 ❯ VitestRunner.dependencyRequest ../../node_modules/vite-node/dist/client.mjs:206:14
 ❯ async /home/elkost/pets/server-users-score/node_modules/@vitest/runner/dist/index.js:3:31
 ❯ VitestRunner.directRequest ../../node_modules/vite-node/dist/client.mjs:308:5
 ❯ VitestRunner.cachedRequest ../../node_modules/vite-node/dist/client.mjs:156:14
 ❯ VitestRunner.dependencyRequest ../../node_modules/vite-node/dist/client.mjs:206:14
 ❯ async /home/elkost/pets/server-users-score/node_modules/vitest/dist/entry.js:5:31
 ❯ VitestRunner.directRequest ../../node_modules/vite-node/dist/client.mjs:308:5

@Leksat
Copy link

Leksat commented Feb 3, 2023

The commit says the fix was released in v0.28.4, yet I'm still getting the error

TypeError: Cannot destructure property 'AsymmetricMatcher' of '__vite_ssr_import_0__.plugins' as it is undefined.
 ❯ ../../../../node_modules/.pnpm/@vitest+utils@0.28.4/node_modules/@vitest/utils/dist/index.js:22:3
     20|   AsymmetricMatcher
     21| ];
     22| function stringify(object, maxDepth = 10, { maxLength, ...options } = {}) {
       |   ^
     23|   const MAX_LENGTH = maxLength ?? 1e4;
     24|   let result;
 ❯ VitestRunner.directRequest ../../../../node_modules/.pnpm/vite-node@0.28.4_@types+node@18.11.18/node_modules/vite-node/dist/client.mjs:312:5
 ❯ VitestRunner.cachedRequest ../../../../node_modules/.pnpm/vite-node@0.28.4_@types+node@18.11.18/node_modules/vite-node/dist/client.mjs:156:14
 ❯ VitestRunner.dependencyRequest ../../../../node_modules/.pnpm/vite-node@0.28.4_@types+node@18.11.18/node_modules/vite-node/dist/client.mjs:204:14
 ❯ async /Users/alex/work/silverback-mono/node_modules/.pnpm/@vitest+runner@0.28.4/node_modules/@vitest/runner/dist/index.js:3:31
 ❯ VitestRunner.directRequest ../../../../node_modules/.pnpm/vite-node@0.28.4_@types+node@18.11.18/node_modules/vite-node/dist/client.mjs:312:5
 ❯ VitestRunner.cachedRequest ../../../../node_modules/.pnpm/vite-node@0.28.4_@types+node@18.11.18/node_modules/vite-node/dist/client.mjs:156:14
 ❯ VitestRunner.dependencyRequest ../../../../node_modules/.pnpm/vite-node@0.28.4_@types+node@18.11.18/node_modules/vite-node/dist/client.mjs:204:14
 ❯ async /Users/alex/work/silverback-mono/node_modules/.pnpm/vitest@0.28.4/node_modules/vitest/dist/entry.js:5:31
 ❯ VitestRunner.directRequest ../../../../node_modules/.pnpm/vite-node@0.28.4_@types+node@18.11.18/node_modules/vite-node/dist/client.mjs:312:5

@sheremet-va
Copy link
Member

The commit says the fix was released in v0.28.4, yet I'm still getting the error

This is a separate bug not related to the one described in the issue. Please, create a new issue and provide a runnable reproduction.

Leksat added a commit to AmazeeLabs/silverback-mono that referenced this issue Feb 3, 2023
@Leksat
Copy link

Leksat commented Feb 4, 2023

Thanks! Created #2806

Leksat added a commit to AmazeeLabs/silverback-mono that referenced this issue Feb 4, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jun 7, 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

Successfully merging a pull request may close this issue.

5 participants